Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update pyjwt #460

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,34 @@ orbs:
ship: auth0/[email protected]
codecov: codecov/codecov@3

executors:
python_3_10:
docker:
- image: cimg/python:3.10

jobs:
build:
executor: python_3_10
build_and_test:
parameters:
py_version:
type: string
default: "3.10"
docker:
- image: cimg/python:<< parameters.py_version >>
steps:
- checkout
- python/install-packages:
pkg-manager: pip
- run: pre-commit run --all-files
- run: coverage run -m unittest
- run: bash <(curl -s https://codecov.io/bash)
- run: make -C docs html
- when:
condition:
equal: [ "3.10", << parameters.py_version >> ]
steps:
- run: make -C docs html

workflows:
main:
jobs:
- build
- build_and_test:
matrix:
parameters:
py_version: [ "3.7", "3.8", "3.9", "3.10", "3.11" ]
- ship/python-publish:
prefix-tag: false
context:
Expand All @@ -36,4 +43,4 @@ workflows:
only:
- master
requires:
- build
- build_and_test
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ You can install the auth0 Python SDK using the following command.
pip install auth0-python
```

For python3, use the following command
```
pip3 install auth0-python
```
Python 3.2 and 3.3 have reached [EOL](https://en.wikipedia.org/wiki/CPython#Version_history) and support will be removed in the near future.
> Requires Python 3.7 or higher.

### Usage

Expand Down
8 changes: 6 additions & 2 deletions auth0/v3/test_async/test_async_auth0.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import platform
import re
import sys
import unittest
from tempfile import TemporaryFile
from unittest import IsolatedAsyncioTestCase

import aiohttp
from aioresponses import CallbackResult, aioresponses
Expand All @@ -27,7 +27,11 @@ def callback(url, **kwargs):
return callback, mock


class TestAsyncify(IsolatedAsyncioTestCase):
@unittest.skipIf(
not hasattr(unittest, "IsolatedAsyncioTestCase"),
"python 3.7 doesn't have IsolatedAsyncioTestCase",
)
class TestAuth0(getattr(unittest, "IsolatedAsyncioTestCase", object)):
@aioresponses()
async def test_get(self, mocked):
callback, mock = get_callback()
Expand Down
20 changes: 17 additions & 3 deletions auth0/v3/test_async/test_async_token_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@ def get_pem_bytes(rsa_public_key):
)


class TestAsyncAsymmetricSignatureVerifier(unittest.IsolatedAsyncioTestCase):
@unittest.skipIf(
not hasattr(unittest, "IsolatedAsyncioTestCase"),
"python 3.7 doesn't have IsolatedAsyncioTestCase",
)
class TestAsyncAsymmetricSignatureVerifier(
getattr(unittest, "IsolatedAsyncioTestCase", object)
):
@aioresponses()
async def test_async_asymmetric_verifier_fetches_key(self, mocked):
callback, mock = get_callback(200, JWKS_RESPONSE_SINGLE_KEY)
Expand All @@ -67,7 +73,11 @@ async def test_async_asymmetric_verifier_fetches_key(self, mocked):
self.assertEqual(get_pem_bytes(key), RSA_PUB_KEY_1_PEM)


class TestAsyncJwksFetcher(unittest.IsolatedAsyncioTestCase):
@unittest.skipIf(
not hasattr(unittest, "IsolatedAsyncioTestCase"),
"python 3.7 doesn't have IsolatedAsyncioTestCase",
)
class TestAsyncJwksFetcher(getattr(unittest, "IsolatedAsyncioTestCase", object)):
@aioresponses()
async def test_async_get_jwks_json_twice_on_cache_expired(self, mocked):
fetcher = AsyncJwksFetcher(JWKS_URI, cache_ttl=1)
Expand Down Expand Up @@ -213,7 +223,11 @@ async def test_async_fails_to_fetch_jwks_json_after_retrying_twice(self, mocked)
self.assertEqual(mock.call_count, 2)


class TestAsyncTokenVerifier(unittest.IsolatedAsyncioTestCase):
@unittest.skipIf(
not hasattr(unittest, "IsolatedAsyncioTestCase"),
"python 3.7 doesn't have IsolatedAsyncioTestCase",
)
class TestAsyncTokenVerifier(getattr(unittest, "IsolatedAsyncioTestCase", object)):
@aioresponses()
async def test_RS256_token_signature_passes(self, mocked):
callback, mock = get_callback(200, {"keys": [PUBLIC_KEY]})
Expand Down
8 changes: 6 additions & 2 deletions auth0/v3/test_async/test_asyncify.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import platform
import re
import sys
import unittest
from tempfile import TemporaryFile
from unittest import IsolatedAsyncioTestCase

import aiohttp
from aioresponses import CallbackResult, aioresponses
Expand Down Expand Up @@ -50,7 +50,11 @@ def callback(url, **kwargs):
return callback, mock


class TestAsyncify(IsolatedAsyncioTestCase):
@unittest.skipIf(
not hasattr(unittest, "IsolatedAsyncioTestCase"),
"python 3.7 doesn't have IsolatedAsyncioTestCase",
)
class TestAsyncify(getattr(unittest, "IsolatedAsyncioTestCase", object)):
@aioresponses()
async def test_get(self, mocked):
callback, mock = get_callback()
Expand Down
9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,14 @@ def find_version():
author_email="[email protected]",
license="MIT",
packages=find_packages(),
install_requires=["requests>=2.14.0", "pyjwt[crypto]>=1.7.1"],
install_requires=["requests>=2.14.0", "pyjwt[crypto]>=2.6.0"],
extras_require={"test": ["coverage", "mock>=1.3.0", "pre-commit"]},
python_requires=">=2.7, !=3.0.*, !=3.1.*",
python_requires=">=3.7",
classifiers=[
"Development Status :: 4 - Beta",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Operating System :: OS Independent",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand Down