Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
# We don't test on Windows currently as it appears mocket may not
# work there.
platform: [ubuntu-latest, macos-latest]
python-version: [3.7, 3.8, 3.9, "3.10", 3.11]
python-version: [3.8, 3.9, "3.10", 3.11, 3.12]

name: Python ${{ matrix.python-version }} on ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
Expand All @@ -34,7 +34,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e git+https://github.com/maxmind/GeoIP2-python#egg=geoip2
pip install tox tox-gh-actions
pip install setuptools tox tox-gh-actions

- name: Test with tox
run: tox
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
History
-------

2.9.0
++++++++++++++++++

* IMPORTANT: Python 3.8 or greater is required. If you are using an older
version, please use an earlier release.

2.8.0 (2023-05-09)
++++++++++++++++++

Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ For asynchronous reporting:
Requirements
------------

Python 3.7 or greater is required. Older versions are not supported.
Python 3.8 or greater is required. Older versions are not supported.

Versioning
----------
Expand Down
2 changes: 1 addition & 1 deletion minfraud/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _ip_address(s: Optional[str]) -> str:
def _email_or_md5(s: str) -> str:
if re.match(r"^[0-9A-Fa-f]{32}$", s):
return s
return validate_email(s, check_deliverability=False).email
return validate_email(s, check_deliverability=False).normalized


# based off of:
Expand Down
6 changes: 5 additions & 1 deletion minfraud/webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@

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

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


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

base_uri = f"https://{host}/minfraud/v2.0"
base_uri = f"{_SCHEME}://{host}/minfraud/v2.0"
self._score_uri = "/".join([base_uri, "score"])
self._insights_uri = "/".join([base_uri, "insights"])
self._factors_uri = "/".join([base_uri, "factors"])
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ authors = [
dependencies = [
"setuptools>=60.0.0",
"aiohttp>=3.6.2,<4.0.0",
"email_validator>=1.1.1,<3.0.0",
"email_validator>=2.0.0,<3.0.0",
"geoip2>=4.7.0,<5.0.0",
"requests>=2.24.0,<3.0.0",
"voluptuous",
]
requires-python = ">=3.7"
requires-python = ">=3.8"
readme = "README.rst"
license = {text = "Apache License 2.0"}
classifiers = [
Expand All @@ -23,11 +23,11 @@ classifiers = [
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet",
"Topic :: Internet :: Proxy Servers",
"Topic :: Internet :: WWW/HTTP",
Expand Down
17 changes: 9 additions & 8 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
max-line-length = 88

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

[gh-actions]
python =
3.7: py37
3.8: py38
3.9: py39
3.10: py310,black,lint,flake8,mypy
3.10: py310
3.11: py311
3.12: py312,black,lint,flake8,mypy

[testenv:{py37,py38,py39,py310}-test]
[testenv:{py38,py39,py310,py311,py312}-test]
deps =
mocket
pytest
Expand All @@ -22,19 +23,19 @@ deps =
charset-normalizer==2.1.1
commands = pytest tests

[testenv:py310-black]
[testenv:py312-black]
deps = black
commands = black --check --diff .

[testenv:py310-lint]
[testenv:py312-lint]
deps = pylint
commands = pylint minfraud

[testenv:py310-flake8]
[testenv:py312-flake8]
deps = flake8
commands = flake8 minfraud

[testenv:py310-mypy]
[testenv:py312-mypy]
deps =
mypy
types-requests
Expand Down
7 changes: 6 additions & 1 deletion tests/test_webservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,13 @@
from minfraud.models import Factors, Insights, Score
from minfraud.webservice import AsyncClient, Client

import minfraud.webservice
import unittest

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


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

base_uri = "https://minfraud.maxmind.com/minfraud/v2.0"
base_uri = "http://minfraud.maxmind.com/minfraud/v2.0"

@httprettified
def test_invalid_auth(self):
Expand Down