question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Removal of kwargs in v2.2.0 is a breaking API change

See original GitHub issue

Example: https://github.com/LibrePhotos/librephotos/issues/373

TypeError: decode() got an unexpected keyword argument ‘verify’

See also https://stackoverflow.com/questions/69485121/django-rest-framework-simple-jwt-decode-got-an-unexpected-keyword-argument-v

Internal Server Error: /api/rqavailable/
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/usr/local/lib/python3.9/dist-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 497, in dispatch
    self.initial(request, *args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 414, in initial
    self.perform_authentication(request)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/views.py", line 324, in perform_authentication
    request.user
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/request.py", line 227, in user
    self._authenticate()
  File "/usr/local/lib/python3.9/dist-packages/rest_framework/request.py", line 380, in _authenticate
    user_auth_tuple = authenticator.authenticate(self)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework_simplejwt/authentication.py", line 35, in authenticate
    validated_token = self.get_validated_token(raw_token)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework_simplejwt/authentication.py", line 89, in get_validated_token
    return AuthToken(raw_token)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework_simplejwt/tokens.py", line 42, in __init__
    self.payload = token_backend.decode(token, verify=verify)
  File "/usr/local/lib/python3.9/dist-packages/rest_framework_simplejwt/backends.py", line 68, in decode
    return jwt.decode(token, self.verifying_key, algorithms=[self.algorithm], verify=verify,
TypeError: decode() got an unexpected keyword argument 'verify'

Expected Result

This error should not occur.

Actual Result

The verify keyword argument is now rejected.

Reproduction Steps

In this case, installing LibrePhotos using Docker Compose. The problem API call is in Django’s rest framework JWT, but the version constraints allowed it to pick up a minor revision which contained a breaking change.

System Information

PyJWT version is 2.2.0. Downgrading to 2.1.0 fixes the problem.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
dajiajicommented, Oct 11, 2021

what about just revert that nd wait for v3.0

Thanks for your suggestion. I thought it would be better that way too. I’ll send a PR to revert (but wait for a couple of days because I cannot have enough time to do).

@jpadilla @auvipy could you release v2.2.1 after that? Sorry for bothering you.

2reactions
auvipycommented, Oct 11, 2021

what about just revert that nd wait for v3.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changes — Flask Documentation (2.2.x)
Update Werkzeug dependency to >= 2.2.2. This includes fixes related to the new faster router, header parsing, and the development server.
Read more >
python - Is it possible to remove an item from argument list?
We can not remove items from the args because it is tuple . As tuple is immutable. but we can create new variable...
Read more >
v2.0 Migration Guide - urllib3 2.0.0a1 documentation
This release contains minor breaking changes and deprecation warnings for other breaking changes. There may be other pre-releases to address fixes before v2.0.0 ......
Read more >
How To Use *args and **kwargs in Python 3 - DigitalOcean
In this tutorial, we will cover the syntax of working with *args and **kwargs as parameters within functions to pass a variable number...
Read more >
Separation of positional and keyword arguments in Ruby 3.0
What is deprecated? ... In Ruby 2, keyword arguments can be treated as the last positional Hash argument and a last positional Hash...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found