Utsav Maji
Utsav Maji

Reputation: 61

ImportError: cannot import name 'url_quote' from 'werkzeug.urls'

Getting this error

> Traceback (most recent call last):
>   File "e:\Documents\Web Dev\Dinkum\backend\app.py", line 2, in
> <module>
>     from flask_oauthlib.client import OAuth   File "E:\Documents\Web Dev\Dinkum\backend\dinkum\Lib\site-packages\flask_oauthlib\client.py",
> line 18, in <module>
>     from werkzeug.urls import url_quote, url_decode, url_encode ImportError: cannot import name 'url_quote' from 'werkzeug.urls'
> (E:\Documents\Web
> Dev\Dinkum\backend\dinkum\Lib\site-packages\werkzeug\urls.py). Did you
> mean: 'unquote'?

using
Flask-OAuthlib version : 0.9.6
Flask version : 3.0.2 on app.py

from flask import Flask, redirect, request, url_for, session, render_template
from flask_oauthlib.client import OAuth

app = Flask(__name__, template_folder=['backend/templates', 'frontend'], static_folder='backend/static')

Upvotes: 1

Views: 3704

Answers (1)

0x00
0x00

Reputation: 1123

url_quote was removed in werkzeug 3.0.0. Which is why you are getting that error in flask_oauthlib.

flask_oauthlib last release was in 2020 and looks like it has been unmaintained. If you read flask_oauthlib repository it says:

You SHOULD use https://github.com/lepture/authlib instead.


You could either downgrade to Flask 2.3.x (and Werkzeug 2.3.x) or use authlib or any other oauthlib so you can use Flask 3.0.x

Upvotes: 0

Related Questions