diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..d593deb --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "python.pythonPath": "/usr/local/bin/python", + "python.linting.pylintEnabled": true +} \ No newline at end of file diff --git a/AUTHORS b/AUTHORS index 1d112ce..2da67c2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -18,6 +18,7 @@ Moritz Pein Stefan Löwen Stefan Richter Stefan Richter +Yury V. Zaytsev achimsen berend denvercoder9 diff --git a/ChangeLog b/ChangeLog index f10e220..22ea260 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,37 @@ CHANGES ======= +3.1.0 +----- + +* removed certificate fingerprint check for compatibility with new figo platform + +3.0.4 +----- + +* version bump to 3.0.4 because of faulty pypi upload + +3.0.3 +----- + +* version bump to 3.0.3 +* Remove old fingerprint since the transition is over to silence warnings +* Fix hardcoded fingerprints botched in 3998871 + +3.0.2 +----- + +* fix credentials.py + +3.0.1 +----- + +* Added new fingerprint + +3.0.0 +----- + +* fix: task\_start is not called with response.json() anymore * most of pep8 * clean up of conftest * added a test for get\_bank @@ -72,6 +103,10 @@ CHANGES 1.7.0 ----- + +v1.6.4 +------ + * fix import * fix import * fix import @@ -228,6 +263,10 @@ CHANGES * bump version to 1.4.1 * added new fingerprint for api.figo.me + +v1.4.0 +------ + * added detailed description to Payment Class * updated more docstrings * updated docstrings @@ -236,15 +275,35 @@ CHANGES * changed version * added add\_user\_and\_login and add\_account\_and\_sync * added missing api calls, models and test cases + +v1.3.2 +------ + * Adding missing bank\_id to bank * Remove some typos (non critical) and a debug output * remove stray space (flake8) + +v1.3.1 +------ + * python 3 compat (and v1.3.1) + +v1.3.0 +------ + * move to new figo.io SDK API level + +v1.2.1 +------ + * increment to v1.2.1 * adding tox.ini to filter out flake8 noise * flake8 fixes * adding flake8 to travis CI + +v1.2.0 +------ + * increment version * adding demo apps * python 2.6 compat diff --git a/README.md b/README.md index 6bc871a..7f90d87 100644 --- a/README.md +++ b/README.md @@ -71,10 +71,8 @@ pip install python-figo[webdemo] # Environment variables -- `FIGO_SSL_FINGERPRINT` - - Override the default fingerprints with a comma seperated list of fingerprints. - `FIGO_API_ENDPOINT` - Override the default API endpoint by setting the environment variable. - `FIGO_CLIENT_ID`, `FIGO_CLIENT_SECRET` - Override to run tests with a client other than the demo client - + diff --git a/figo/credentials.py b/figo/credentials.py index 3a64d5c..9ca2e86 100644 --- a/figo/credentials.py +++ b/figo/credentials.py @@ -4,9 +4,6 @@ 'client_id': 'C-9rtYgOP3mjHhw0qu6Tx9fgk9JfZGmbMqn-rnDZnZwI', 'client_secret': 'Sv9-vNfocFiTe_NoMRkvNLe_jRRFeESHo8A0Uhyp7e28', 'api_endpoint': 'https://api.figo.me', - # string containing comma-separated list of SSL fingerprints - 'ssl_fingerprints': 'CD:F3:D3:26:27:89:91:B9:CD:AE:4B:10:6C:96:81:B7:' - 'EB:B3:38:10:C4:72:37:6A:4D:9C:84:B7:B3:DC:D6:8D', } DEMO_TOKEN = ('ASHWLIkouP2O6_bgA2wWReRhletgWKHYjLqDaqb0LFfamim9RjexTo' @@ -16,5 +13,4 @@ 'client_id': os.getenv('FIGO_CLIENT_ID', DEMO_CREDENTIALS['client_id']), 'client_secret': os.getenv('FIGO_CLIENT_SECRET', DEMO_CREDENTIALS['client_secret']), 'api_endpoint': os.getenv('FIGO_API_ENDPOINT', DEMO_CREDENTIALS['api_endpoint']), - 'ssl_fingerprints': os.getenv('FIGO_SSL_FINGERPRINT', DEMO_CREDENTIALS['ssl_fingerprints']), } diff --git a/figo/figo.py b/figo/figo.py index 55c74aa..7ecf629 100644 --- a/figo/figo.py +++ b/figo/figo.py @@ -14,7 +14,6 @@ from datetime import timedelta from requests.exceptions import SSLError from requests import Session -from requests_toolbelt.adapters.fingerprint import FingerprintAdapter from time import sleep from figo.credentials import CREDENTIALS @@ -82,13 +81,11 @@ class FigoObject(object): def __init__(self, api_endpoint=CREDENTIALS['api_endpoint'], - fingerprints=CREDENTIALS['ssl_fingerprints'], language=None): """Create a FigoObject instance. Args: api_endpoint (str) - base URI of the server to call - fingerprints ([str]) - list of the server's SSL fingerprints language (str) - language for HTTP request header """ self.headers = { @@ -98,7 +95,6 @@ def __init__(self, } self.language = language self.api_endpoint = api_endpoint - self.fingerprints = fingerprints.split(',') def _request_api(self, path, data=None, method="GET"): """Helper method for making a REST-compliant API call. @@ -117,19 +113,10 @@ def _request_api(self, path, data=None, method="GET"): session = Session() session.headers.update(self.headers) - for fingerprint in self.fingerprints: - session.mount(self.api_endpoint, FingerprintAdapter(fingerprint.lower())) - try: - response = session.request(method, complete_path, json=data) - except SSLError: - logging.warn('Fingerprint "%s" was invalid', fingerprint) - else: - break - finally: - session.close() - else: - raise SSLError - + try: + response = session.request(method, complete_path, json=data) + finally: + session.close() if 200 <= response.status_code < 300 or self._has_error(response.json()): if response.text == '': @@ -244,7 +231,6 @@ class FigoConnection(FigoObject): def __init__(self, client_id, client_secret, redirect_uri, api_endpoint=CREDENTIALS['api_endpoint'], - fingerprints=CREDENTIALS['ssl_fingerprints'], language=None): """ Create a FigoConnection instance. @@ -255,11 +241,9 @@ def __init__(self, client_id, client_secret, redirect_uri, redirect_uri (str) - the URI the users gets redirected to after the login is finished or if they press `cancel` api_endpoint (str) - base URI of the server to call - fingerprints ([str]) - list of the server's SSL fingerprints language (str) - language for HTTP request header """ - super(FigoConnection, self).__init__(api_endpoint=api_endpoint, fingerprints=fingerprints, - language=language) + super(FigoConnection, self).__init__(api_endpoint=api_endpoint, language=language) self.client_id = client_id self.client_secret = client_secret @@ -467,7 +451,6 @@ class FigoSession(FigoObject): """ def __init__(self, access_token, sync_poll_retry=20, api_endpoint=CREDENTIALS['api_endpoint'], - fingerprints=CREDENTIALS['ssl_fingerprints'], language=None, ): """Create a FigoSession instance. @@ -476,11 +459,9 @@ def __init__(self, access_token, sync_poll_retry=20, access_token (str) - the access token to bind this session to a user sync_poll_retry (int) - maximum number of synchronization poll retries api_endpoint (str) - base URI of the server to call - fingerprints ([str]) - list of the server's SSL fingerprints language (str) - language for HTTP request header """ - super(FigoSession, self).__init__(api_endpoint=api_endpoint, fingerprints=fingerprints, - language=language) + super(FigoSession, self).__init__(api_endpoint=api_endpoint,language=language) self.access_token = access_token self.headers.update({'Authorization': "Bearer {0}".format(self.access_token)}) diff --git a/tests/conftest.py b/tests/conftest.py index affd412..4d2a655 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -23,8 +23,7 @@ def figo_connection(): return FigoConnection(CREDENTIALS['client_id'], CREDENTIALS['client_secret'], "https://127.0.0.1/", - api_endpoint=CREDENTIALS['api_endpoint'], - fingerprints=CREDENTIALS['ssl_fingerprints']) + api_endpoint=CREDENTIALS['api_endpoint']) @pytest.fixture(scope='module') diff --git a/tox.ini b/tox.ini index f738fda..7c6460b 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,6 @@ commands=py.test {posargs} passenv = FIGO_CLIENT_ID FIGO_CLIENT_SECRET - FIGO_SSL_FINGERPRINT FIGO_API_ENDPOINT [testenv:py27]