4
4
import hmac
5
5
import json
6
6
import time
7
- from typing import *
8
- from urllib .parse import urlencode
7
+ from typing import Dict , Optional
9
8
10
9
from veryfi .errors import VeryfiClientError
11
10
@@ -18,13 +17,13 @@ class Client:
18
17
19
18
def __init__ (
20
19
self ,
21
- client_id ,
22
- client_secret ,
23
- username ,
24
- api_key ,
25
- base_url = BASE_URL ,
26
- api_version = API_VERSION ,
27
- timeout = API_TIMEOUT ,
20
+ client_id : str ,
21
+ client_secret : str ,
22
+ username : str ,
23
+ api_key : str ,
24
+ base_url : str = BASE_URL ,
25
+ api_version : str = API_VERSION ,
26
+ timeout : int = API_TIMEOUT ,
28
27
):
29
28
self .client_id = client_id
30
29
self .client_secret = client_secret
@@ -53,7 +52,13 @@ def _get_headers(self) -> Dict:
53
52
54
53
return final_headers
55
54
56
- def _request (self , http_verb , endpoint_name , request_arguments = None , query_params = None ):
55
+ def _request (
56
+ self ,
57
+ http_verb : str ,
58
+ endpoint_name : str ,
59
+ request_arguments : Optional [Dict ] = None ,
60
+ query_params : Optional [Dict ] = None ,
61
+ ):
57
62
"""
58
63
Submit the HTTP request.
59
64
:param http_verb: HTTP Method
@@ -62,7 +67,7 @@ def _request(self, http_verb, endpoint_name, request_arguments=None, query_param
62
67
:return: A JSON of the response data.
63
68
"""
64
69
headers = self ._get_headers ()
65
- api_url = "{0 }/partner{1}" . format ( self . versioned_url , endpoint_name )
70
+ api_url = f" { self . versioned_url } /partner{ endpoint_name } "
66
71
request_arguments = request_arguments or {}
67
72
68
73
if self .client_secret :
@@ -89,7 +94,7 @@ def _request(self, http_verb, endpoint_name, request_arguments=None, query_param
89
94
90
95
return response .json ()
91
96
92
- def _generate_signature (self , payload_params , timestamp ) :
97
+ def _generate_signature (self , payload_params : Dict , timestamp : int ) -> str :
93
98
"""
94
99
Generate unique signature for payload params.
95
100
:param payload_params: JSON params to be sent to API request
0 commit comments