Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
3049f44
Don't explicitly inherit from object
oschwald Jul 13, 2020
728c884
Do not test on 2.7, 3.5, and PyPy
oschwald Jul 13, 2020
d0a8fae
Updated supported Python versions in docs and setup.py
oschwald Jul 13, 2020
f5ba44a
Require geoip2 4.0.0
oschwald Jul 13, 2020
53dc944
Do not depend on geoip2.compat
oschwald Jul 13, 2020
26f8efa
Remove Python 2 compat validation code
oschwald Jul 13, 2020
17a6479
Remove Python 2 unittest compat code
oschwald Jul 13, 2020
310bf98
Fix several minor pylint issues
oschwald Jul 13, 2020
4452f11
Add types for model classes (and fix some doc types)
oschwald Jul 13, 2020
6b78a6f
Get rid of user_id support
oschwald Jul 13, 2020
ad5d3ea
Add types for other code
oschwald Jul 13, 2020
294a174
Run mypy on Travis
oschwald Jul 13, 2020
ecdf1a6
Replace validate_email email_validator
oschwald Jul 13, 2020
662cb49
Mention dropping Python 2 support and adding type hints in history
oschwald Jul 13, 2020
cbb4218
Switch to urllib.parse for URL validation
oschwald Jul 13, 2020
048ad3f
Do RFC3339 validation with regular expression
oschwald Jul 13, 2020
ab9c1eb
Minor changes to quiet mypy
oschwald Jul 13, 2020
28f048f
Reenable pylint check
oschwald Jul 13, 2020
9751eef
Install geoip2 from Git
oschwald Jul 14, 2020
852ec10
Install twine during release
oschwald Jul 14, 2020
4dacdb1
Don't use Optional for values we always return
oschwald Jul 14, 2020
594db76
Set the ASCII flag on the regex
oschwald Jul 14, 2020
190ee89
Remove specific service names from Client summary
oschwald Jul 14, 2020
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
13 changes: 3 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,25 @@ sudo: false
language: python
matrix:
include:
- python: 2.7
dist: trusty
- python: 3.5
dist: trusty
- python: 3.6
dist: trusty
- python: 3.7
dist: xenial
- python: 3.8
dist: xenial
env:
- RUN_LINTER=1
- RUN_SNYK=1
- python: nightly
dist: xenial
- python: pypy
dist: trusty
allow_failures:
- python: nightly

before_install:
- "if [[ $RUN_SNYK && $SNYK_TOKEN ]]; then sudo apt-get install -y nodejs; npm install -g snyk; fi"
install:
- "if [[ $RUN_LINTER ]]; then pip install --upgrade pylint black; fi"
- pip install -e git+https://github.com/maxmind/GeoIP2-python#egg=geoip2
- "if [[ $RUN_LINTER ]]; then pip install --upgrade pylint black mypy voluptuous-stubs; fi"
script:
- python setup.py test
- "if [[ $RUN_LINTER ]]; then mypy minfraud tests; fi"
- "if [[ $RUN_LINTER ]]; then ./.travis-pylint.sh; fi"
- "if [[ $RUN_LINTER ]]; then ./.travis-black.sh; fi"
- "if [[ $RUN_SNYK && $SNYK_TOKEN ]]; then snyk test --org=maxmind --file=requirements.txt; fi"
Expand Down
10 changes: 10 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
History
-------

2.0.0

* IMPORTANT: Python 2.7 and 3.5 support has been dropped. Python 3.6 or greater
is required.
* Type hints have been added.
* Email validation is now done with ``email_validator`` rather than
``validate_email``.
* URL validation is now done with ``urllib.parse`` rather than ``rfc3987``.
* RFC 3339 timestamp validation is now done via a regular expression.

1.13.0 (2020-07-14)
+++++++++++++++++++

Expand Down
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ minFraud Score, Insights, Factors and Report Transaction Python API
Description
-----------

This package provides an API for the `MaxMind minFraud Score, Insights, and
This package provides an API for the `MaxMind minFraud Score, Insights, and
Factors web services <https://dev.maxmind.com/minfraud/>`_ as well as the
`Report Transaction web service
<https://dev.maxmind.com/minfraud/report_transaction>`_.
Expand Down Expand Up @@ -252,8 +252,7 @@ Report Transactions Example
Requirements
------------

This code requires Python 2.7+ or 3.5+. Older versions are not supported.
This library has been tested with CPython and PyPy.
Python 3.6 or greater is required. Older versions are not supported.

Versioning
----------
Expand Down
2 changes: 1 addition & 1 deletion dev-bin/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ if [ -n "$(git status --porcelain)" ]; then
fi

# Make sure release deps are installed with the current python
pip install -U sphinx wheel voluptuous strict_rfc3339 validate_email rfc3987
pip install -U sphinx wheel voluptuous email_validator twine

perl -pi -e "s/(?<=__version__ = \").+?(?=\")/$version/g" minfraud/version.py

Expand Down
6 changes: 5 additions & 1 deletion minfraud/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

"""

from typing import Optional


class MinFraudError(RuntimeError):
"""There was a non-specific error in minFraud.
Expand Down Expand Up @@ -39,7 +41,9 @@ class HTTPError(MinFraudError):

"""

def __init__(self, message, http_status=None, uri=None):
def __init__(
self, message: str, http_status: Optional[int] = None, uri: Optional[str] = None
) -> None:
super(HTTPError, self).__init__(message)
self.http_status = http_status
self.uri = uri
Expand Down
Loading