Skip to content
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

Reintroducing support for Python 3.7 and 3.8 #70

Merged
merged 63 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3ee9278
Merge branch 'master' into develop
hbldh Jul 8, 2021
3ce57aa
Update README.rst
dotchetter Nov 15, 2021
b70c83a
Merge pull request #41 from dotchetter/develop
hbldh Nov 16, 2021
3fcb447
Update __init__.py
cthart May 4, 2023
dfbb035
Merge branch 'master' into develop
hbldh May 5, 2023
92ee2a8
Merge pull request #48 from cthart/patch-3
hbldh May 5, 2023
27ea5e1
Github Action fixes
hbldh May 5, 2023
5390eda
Version bump
hbldh May 5, 2023
bd831f9
Bump reqs for example
hbldh May 5, 2023
8e513f4
Bundle the BankID Test certificate
hbldh May 5, 2023
18888ab
Failure detection in openssl test cert conversion
1sfb May 6, 2023
3b12c35
Add possibility to provide p12 test cert through existing file
1sfb May 6, 2023
dccb096
Bundle the BankID Test certificate in pem format
hbldh May 7, 2023
939a8a1
Merge branch 'develop' into master
hbldh May 7, 2023
636ac44
Merge pull request #50 from 1sfb/master
hbldh May 7, 2023
91f9b26
Python 2.7 compat. fix
hbldh May 7, 2023
873e495
Rmoving certutils test for the time being
hbldh May 7, 2023
ba592d4
Remove Python 2.7 support
hbldh May 7, 2023
52e33f7
Remove six dependency
hbldh May 7, 2023
cab407b
Merge branch 'master' into develop
hbldh Dec 15, 2023
b742236
Async client using httpx (#55)
tiwilliam Dec 15, 2023
c5b5c6b
Add support for RP v6.0
mxamin Jan 18, 2024
a286ee3
Merge pull request #58 from mxamin/add-jsonclient-v6
hbldh Mar 21, 2024
cf9ec7a
First draft of v6 clients
hbldh Mar 21, 2024
024b7cb
Corrected the example app to work with v1.0.0
hbldh Mar 22, 2024
beb4e0c
Documentation update
hbldh Mar 22, 2024
77626a9
Cleanup before PR
hbldh Mar 22, 2024
8e6c1a6
Remove .vscode folder
hbldh Mar 22, 2024
e1d77b3
Minor doc change
hbldh Mar 22, 2024
696d89e
Updated README.rst
hbldh Mar 22, 2024
3a5dda7
CI changes
hbldh Mar 22, 2024
65dd435
Upgrading CI action versions
hbldh Mar 22, 2024
cba58a6
Implemented phone/auth and phone/sign
hbldh Mar 22, 2024
178f84e
Update certutils.py
cthart Apr 3, 2024
4913557
Expose QR code helper explicitly.
Majsvaffla Apr 8, 2024
46a8447
Update README.rst - use pytest instead of py.test
pelme Apr 12, 2024
4392874
Merge pull request #62 from hbldh/generate-qr-code-util
hbldh Apr 12, 2024
f63f9be
Merge branch 'develop' into patch-1
hbldh Apr 12, 2024
890e287
Merge pull request #63 from pelme/patch-1
hbldh Apr 12, 2024
632ff39
Version 1.0.1 - Docfix and QR method separate
hbldh Apr 12, 2024
b4773ab
Cache ip addresses in test suite.
pelme Apr 15, 2024
6380923
Merge branch 'master' into develop
hbldh Apr 15, 2024
296d250
Use builtin importlib.resources.
pelme Apr 15, 2024
151d30b
Documentation updates
hbldh Apr 15, 2024
c0c8158
Merge pull request #65 from pelme/ip-address-cache
hbldh Apr 15, 2024
4beaca3
Merge branch 'develop' into builtin-importlib-resources
hbldh Apr 15, 2024
43f1245
Merge pull request #66 from pelme/builtin-importlib-resources
hbldh Apr 15, 2024
adcd2be
Dropping use of httpbin for external ip
hbldh Apr 15, 2024
fafa06b
Merge pull request #61 from cthart/patch-4
hbldh Apr 15, 2024
11b4c85
Fix for async test
hbldh Apr 15, 2024
7ea31e1
Add mypy to dev deps.
Majsvaffla Apr 16, 2024
06213ae
mypy --install-types
Majsvaffla Apr 16, 2024
aed72c6
Drop duplicate method.
Majsvaffla Apr 16, 2024
63e2c33
Fix type errors and add type annotations.
Majsvaffla Apr 16, 2024
0938ecd
Add type checking to CI.
Majsvaffla Apr 16, 2024
aa4d46c
Add CONTRIBUTING.md
Majsvaffla Apr 16, 2024
84558c6
Merge pull request #67 from hbldh/mypy
hbldh Apr 17, 2024
ccaa74c
Merge branch 'master' into develop
hbldh Apr 24, 2024
dde93ec
Attempted fix of importlib
hbldh Apr 29, 2024
0c63e65
Removed walrus operator
hbldh Apr 29, 2024
9f490c1
Fix for mypy in 3.7 and 3.8
hbldh Apr 29, 2024
9b71945
Another attempt to fix mypy
hbldh Apr 29, 2024
0dba57f
Another attempt to fix mypy number 2
hbldh Apr 29, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9, '3.10', '3.11', '3.12']
python-version: [3.7, 3.8, 3.9, '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v4

Expand Down
11 changes: 8 additions & 3 deletions bankid/certutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
"""

import os
import sys
import subprocess
from typing import Tuple, Union

import pathlib
import importlib.resources
if sys.version_info < (3, 9):
import importlib_resources as impres
else:
import importlib.resources as impres

from bankid.certs import get_test_cert_p12
from bankid.exceptions import BankIDError
Expand All @@ -19,7 +23,7 @@


def resolve_cert_path(file: str) -> pathlib.Path:
path = importlib.resources.files("bankid.certs").joinpath(file)
path = impres.files("bankid.certs").joinpath(file)
assert isinstance(path, pathlib.Path)
return path

Expand All @@ -37,7 +41,8 @@ def create_bankid_test_server_cert_and_key(destination_path: str = ".") -> Tuple
:rtype: tuple

"""
if test_cert_file := os.getenv("TEST_CERT_FILE"):
test_cert_file = os.getenv("TEST_CERT_FILE")
if test_cert_file is not None:
certificate, key = split_certificate(
test_cert_file, destination_path, password=_TEST_CERT_PASSWORD
)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
httpx
importlib_resources; python_version < "3.9"
11 changes: 9 additions & 2 deletions tests/test_exceptions.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
from collections import namedtuple
import sys
from typing import Union

import pytest

import bankid

if sys.version_info >= (3, 9):
from builtins import type as Type
else:
# Remove once PyBankID no longer support Python 3.8 or lower
from typing import Type


@pytest.mark.parametrize(
"exception_class,rfa",
Expand All @@ -19,7 +26,7 @@
(bankid.exceptions.BankIDError, None),
],
)
def test_exceptions(exception_class: type[Exception], rfa: Union[int, None]) -> None:
def test_exceptions(exception_class: Type[Exception], rfa: Union[int, None]) -> None:
e = exception_class()
assert isinstance(e, bankid.exceptions.BankIDError)
assert e.rfa == rfa
Expand All @@ -38,7 +45,7 @@ def test_exceptions(exception_class: type[Exception], rfa: Union[int, None]) ->
(bankid.exceptions.BankIDError, "Unknown error code"),
],
)
def test_error_class_factory(exception_class: type[Exception], error_code: str) -> None:
def test_error_class_factory(exception_class: Type[Exception], error_code: str) -> None:
MockResponse = namedtuple("MockResponse", ["json"])
response = MockResponse(json=lambda: {"errorCode": error_code})
# error: Argument 1 to "get_json_error_class" has incompatible type "MockResponse@41"; expected "Response" [arg-type]
Expand Down