Skip to content

Commit

Permalink
Use v8 by default, lower timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Valeriy Mukhtarulin committed Feb 25, 2022
1 parent fea26e4 commit 557200c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
CHANGES
=======

3.0.0
-----
* Use v8 by default, lower timeout

2.1.0
-----
* BREAKING - Remove process\_document\_file
Expand Down
18 changes: 6 additions & 12 deletions veryfi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@


class Client:
API_VERSION = "v7"
API_TIMEOUT = 120
API_VERSION = "v8"
API_TIMEOUT = 30
BASE_URL = "https://api.veryfi.com/api/"
CATEGORIES = [
"Advertising & Marketing",
Expand Down Expand Up @@ -48,8 +48,9 @@ def __init__(
self.username = username
self.api_key = api_key
self.base_url = base_url
self.timeout = timeout
self.api_version = api_version
self.versioned_url = self.base_url + self.api_version
self.timeout = timeout
self.headers = {}
self._session = requests.Session()

Expand All @@ -59,7 +60,7 @@ def _get_headers(self) -> Dict:
:return: Dictionary with headers
"""
final_headers = {
"User-Agent": "Python Veryfi-Python/2.0.0",
"User-Agent": "Python Veryfi-Python/3.0.0",
"Accept": "application/json",
"Content-Type": "application/json",
"Client-Id": self.client_id,
Expand All @@ -69,13 +70,6 @@ def _get_headers(self) -> Dict:

return final_headers

def _get_url(self):
"""
Get API Base URL with API Version
:return: Base URL to Veryfi API
"""
return self.base_url + self.api_version

def _request(self, http_verb, endpoint_name, request_arguments):
"""
Submit the HTTP request.
Expand All @@ -85,7 +79,7 @@ def _request(self, http_verb, endpoint_name, request_arguments):
:return: A JSON of the response data.
"""
headers = self._get_headers()
api_url = "{0}/partner{1}".format(self._get_url(), endpoint_name)
api_url = "{0}/partner{1}".format(self.versioned_url, endpoint_name)

if self.client_secret:
timestamp = int(time.time() * 1000)
Expand Down

0 comments on commit 557200c

Please sign in to comment.