Skip to content

Commit 7e64e1c

Browse files
authored
Merge pull request #123 from maxmind/greg/python-3.12
List 3.12 as supported and test on it
2 parents 48723ec + a5debd4 commit 7e64e1c

File tree

8 files changed

+33
-17
lines changed

8 files changed

+33
-17
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
# We don't test on Windows currently as it appears mocket may not
1515
# work there.
1616
platform: [ubuntu-latest, macos-latest]
17-
python-version: [3.7, 3.8, 3.9, "3.10", 3.11]
17+
python-version: [3.8, 3.9, "3.10", 3.11, 3.12]
1818

1919
name: Python ${{ matrix.python-version }} on ${{ matrix.platform }}
2020
runs-on: ${{ matrix.platform }}
@@ -34,7 +34,7 @@ jobs:
3434
run: |
3535
python -m pip install --upgrade pip
3636
pip install -e git+https://github.com/maxmind/GeoIP2-python#egg=geoip2
37-
pip install tox tox-gh-actions
37+
pip install setuptools tox tox-gh-actions
3838
3939
- name: Test with tox
4040
run: tox

HISTORY.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
History
44
-------
55

6+
2.9.0
7+
++++++++++++++++++
8+
9+
* IMPORTANT: Python 3.8 or greater is required. If you are using an older
10+
version, please use an earlier release.
11+
612
2.8.0 (2023-05-09)
713
++++++++++++++++++
814

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ For asynchronous reporting:
306306
Requirements
307307
------------
308308

309-
Python 3.7 or greater is required. Older versions are not supported.
309+
Python 3.8 or greater is required. Older versions are not supported.
310310

311311
Versioning
312312
----------

minfraud/validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def _ip_address(s: Optional[str]) -> str:
5757
def _email_or_md5(s: str) -> str:
5858
if re.match(r"^[0-9A-Fa-f]{32}$", s):
5959
return s
60-
return validate_email(s, check_deliverability=False).email
60+
return validate_email(s, check_deliverability=False).normalized
6161

6262

6363
# based off of:

minfraud/webservice.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232

3333
_REQUEST_UA = f"minFraud-API/{__version__} {requests.utils.default_user_agent()}"
3434

35+
# We have this so that we can avoid a mocket issue:
36+
# https://github.com/mindflayer/python-mocket/issues/209
37+
_SCHEME = "https"
38+
3539

3640
# pylint: disable=too-many-instance-attributes, missing-class-docstring
3741
class BaseClient:
@@ -58,7 +62,7 @@ def __init__(
5862
self._license_key = license_key
5963
self._timeout = timeout
6064

61-
base_uri = f"https://{host}/minfraud/v2.0"
65+
base_uri = f"{_SCHEME}://{host}/minfraud/v2.0"
6266
self._score_uri = "/".join([base_uri, "score"])
6367
self._insights_uri = "/".join([base_uri, "insights"])
6468
self._factors_uri = "/".join([base_uri, "factors"])

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ authors = [
88
dependencies = [
99
"setuptools>=60.0.0",
1010
"aiohttp>=3.6.2,<4.0.0",
11-
"email_validator>=1.1.1,<3.0.0",
11+
"email_validator>=2.0.0,<3.0.0",
1212
"geoip2>=4.7.0,<5.0.0",
1313
"requests>=2.24.0,<3.0.0",
1414
"voluptuous",
1515
]
16-
requires-python = ">=3.7"
16+
requires-python = ">=3.8"
1717
readme = "README.rst"
1818
license = {text = "Apache License 2.0"}
1919
classifiers = [
@@ -23,11 +23,11 @@ classifiers = [
2323
"License :: OSI Approved :: Apache Software License",
2424
"Programming Language :: Python",
2525
"Programming Language :: Python :: 3",
26-
"Programming Language :: Python :: 3.7",
2726
"Programming Language :: Python :: 3.8",
2827
"Programming Language :: Python :: 3.9",
2928
"Programming Language :: Python :: 3.10",
3029
"Programming Language :: Python :: 3.11",
30+
"Programming Language :: Python :: 3.12",
3131
"Topic :: Internet",
3232
"Topic :: Internet :: Proxy Servers",
3333
"Topic :: Internet :: WWW/HTTP",

setup.cfg

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,17 @@
33
max-line-length = 88
44

55
[tox:tox]
6-
envlist = {py37,py38,py39,py310}-test,py310-{black,lint,flake8,mypy}
6+
envlist = {py38,py39,py310,py311,py312}-test,py312-{black,lint,flake8,mypy}
77

88
[gh-actions]
99
python =
10-
3.7: py37
1110
3.8: py38
1211
3.9: py39
13-
3.10: py310,black,lint,flake8,mypy
12+
3.10: py310
13+
3.11: py311
14+
3.12: py312,black,lint,flake8,mypy
1415

15-
[testenv:{py37,py38,py39,py310}-test]
16+
[testenv:{py38,py39,py310,py311,py312}-test]
1617
deps =
1718
mocket
1819
pytest
@@ -22,19 +23,19 @@ deps =
2223
charset-normalizer==2.1.1
2324
commands = pytest tests
2425

25-
[testenv:py310-black]
26+
[testenv:py312-black]
2627
deps = black
2728
commands = black --check --diff .
2829

29-
[testenv:py310-lint]
30+
[testenv:py312-lint]
3031
deps = pylint
3132
commands = pylint minfraud
3233

33-
[testenv:py310-flake8]
34+
[testenv:py312-flake8]
3435
deps = flake8
3536
commands = flake8 minfraud
3637

37-
[testenv:py310-mypy]
38+
[testenv:py312-mypy]
3839
deps =
3940
mypy
4041
types-requests

tests/test_webservice.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,13 @@
1919
from minfraud.models import Factors, Insights, Score
2020
from minfraud.webservice import AsyncClient, Client
2121

22+
import minfraud.webservice
2223
import unittest
2324

25+
# We have this so that we can avoid a mocket issue:
26+
# https://github.com/mindflayer/python-mocket/issues/209
27+
minfraud.webservice._SCHEME = "http"
28+
2429

2530
class BaseTest(unittest.TestCase):
2631
client_class: Union[Type[AsyncClient], Type[Client]] = Client
@@ -36,7 +41,7 @@ def setUp(self):
3641
with open(os.path.join(test_dir, self.response_file), encoding="utf-8") as file:
3742
self.response = file.read()
3843

39-
base_uri = "https://minfraud.maxmind.com/minfraud/v2.0"
44+
base_uri = "http://minfraud.maxmind.com/minfraud/v2.0"
4045

4146
@httprettified
4247
def test_invalid_auth(self):

0 commit comments

Comments
 (0)