forked from SynapseFI/SynapseFI-Python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.py
More file actions
36 lines (29 loc) · 1.19 KB
/
client.py
File metadata and controls
36 lines (29 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from .http_client import HttpClient
from .api.users import Users
from .api.trans import Trans
from .api.nodes import Nodes
class Client():
"""Handles configuration and requests to the SynapsePay API.
"""
def __init__(self, **kwargs):
"""Create a new API client.
Args:
client_id (str): your API client id
client_secret (str): your API client secret
fingerprint (str): the user's fingerprint
ip_address (str): the user's IP address
development_mode (bool): if True, requests sent to sandbox
endpoints (else production)
logging (bool): if True, requests logged to stdout
Todo:
Allow logging to file
"""
self.base_url = 'https://synapsepay.com/api/3'
if kwargs.get('development_mode'):
self.base_url = 'https://uat-api.synapsefi.com/v3.1'
self.http_client = HttpClient(base_url=self.base_url, **kwargs)
self.users = Users(self.http_client)
self.nodes = Nodes(self.http_client)
self.trans = Trans(self.http_client)
def __repr__(self):
return '{0}(base_url={1})'.format(self.__class__, self.base_url)