Comments (17)
And.. It's because it's now called content_type.. not mimetype and HttpResponse should be called like
return HttpResponse(
json.dumps(response_data), content_type='application/json'
)
from django-oauth2-provider.
Further to the comment by @edmenendez there are a number of lines in views.py namely: 301, 466 and 491 - the new (v1.7) HttpResponse
constructor uses the param name content_type
in place of mimetype
, so a simple solution is to make the replacement.
from django-oauth2-provider.
@kevbradwick Upstream appears to be dead, so maybe never. If you absolutely cannot switch over to using Django OAuth Toolkit, then you should be able to use @glassresistor's zip file or repo.
Use pip
to install the zip file:
$ pip install https://github.com/glassresistor/django-oauth2-provider/archive/stable.zip#django-oauth2-provider
or specify it directly in requirements.txt
:
...
https://github.com/glassresistor/django-oauth2-provider/archive/stable.zip#django-oauth2-provider
...
Tell pip
to install from @glassresistor's repository:
$ pip install -e git+https://github.com/glassresistor/django-oauth2-provider.git#egg=django-oauth2-provider
or specify it directly in requirements.txt
:
...
-e git+https://github.com/glassresistor/django-oauth2-provider.git#egg=django-oauth2-provider
...
And just a heads up: unfortunately pip
does not save where it installed packages from, so running pip freeze > requirements.txt
will not write the appropriate URL to the requirements.txt
file. C'est la vie, I guess.
from django-oauth2-provider.
any news on this?? i am having the same problem with Django 1.7
from django-oauth2-provider.
Same with Django 1.7. It's happening everywhere else I'm trying to return a HttpResponse with a mimetype. So this is not specific to django-oauth2-provider.
from django-oauth2-provider.
I've the same issue here in 1.7 ... anyone have solution?
mimetype="application/json"
File "/usr/local/lib/python2.7/dist-packages/django/http/response.py", line 318, in init
super(HttpResponse, self).init(*args, **kwargs)
TypeError: init() got an unexpected keyword argument 'mimetype'
from django-oauth2-provider.
my solution was to start using django oauth toolkit
, when this gets fixed i might give it another try
from django-oauth2-provider.
Yes, change line 491 at https://github.com/caffeinehit/django-oauth2-provider/blob/master/provider/views.py#L491 to use content_type instead of mimetype.
from django-oauth2-provider.
@edmenendez In 1.7 there's a JSONResponse class, I think I used that in the pull request that's linked to this issue.
from django-oauth2-provider.
#93 fixes this as well.
from django-oauth2-provider.
+1 on this
from django-oauth2-provider.
Hi Guys, I followed the recommendations in this thread as a temporary solution for this issue. However, I'm using PIP. Somehow my latest PIP Install didn't include the fix. How do I make sure future PIP installations include the fix for this app? At the moment I'm manually fixing stuff on the server side and on my dev machine after using PIP. I really like PIP so I hope the fix will be available with PIP installation soons. Thanks.
from django-oauth2-provider.
Further to the comment by @edmenendez and @tomwalters above, changing all instances of the mimetype function parameter and return in views.py as described worked for me. Django 1.7.1
from django-oauth2-provider.
Any ideas when this fix will make it in to master and released?
from django-oauth2-provider.
In Django 1.6, the HttpResponse is like
if mimetype:
warnings.warn("Using mimetype keyword argument is deprecated, use"
" content_type instead",
DeprecationWarning, stacklevel=2)
content_type = mimetype
We are just warning and assigning the mimetype to the content_type.
In Django 1.8, we are not using mimetype. Instead of this directly we are assigning the value like "image/png", etc.., to the content_type. Just a DRY concept.
from django-oauth2-provider.
I've the same issue here in 1.6.11
mimetype="application/json"
File "/usr/local/lib/python2.7/dist-packages/django/http/response.py", line 318, in init
super(HttpResponse, self).init(_args, *_kwargs)
TypeError: init() got an unexpected keyword argument 'mimetype'
Further to the comment by @edmenendez and @tomwalters above, changing all instances of the mimetype function parameter and return in views.py as described worked for me. Django 1.6.11
at https://docs.djangoproject.com/en/1.9/internals/deprecation/#deprecation-removed-in-1-7
I find this:
The mimetype argument to the init methods of HttpResponse, SimpleTemplateResponse, and TemplateResponse, will be removed. content_type should be used instead. This also applies to the render_to_response() shortcut and the sitemap views, index() and sitemap().
but i can't understand why the warning appear in django 1.6 until i saw the comment by @aravindaran
from django-oauth2-provider.
Fixed this in https://bitbucket.org/ckarrie/django-piston
from django-oauth2-provider.
Related Issues (20)
- authorize endpoint doesn't seem to support "token" response type (implicit grant) HOT 7
- Timing Leaks in authenticate() HOT 1
- [QUESTION] Support for this project HOT 2
- Django 1.8 migrations are broken HOT 1
- Curl doesn't return access token HOT 1
- Django 1.8.6 migration error HOT 1
- Custom confirm template HOT 5
- Cannot get refresh token
- oauth2_provider_application
- provider.oauth2 seems not to appear when added from pip on settings.py HOT 4
- Needs an Update
- not working with django>=1.9 HOT 3
- Error messages translation
- django next url γError: invalid_request Missing client_id parameter.γ
- Invalid grant
- Refresh token not returned HOT 1
- "Invalid credentials given" -> How can I set this message?
- There should be a way to keep user logged in at one device only.
- Project is Dead. Need a Migration Plan HOT 1
- Premature pull request and more updates incoming
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-oauth2-provider.