added gitignore
This commit is contained in:
parent
c56243589b
commit
e14328c68b
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
__pycache__
|
||||||
@ -2,27 +2,6 @@ import requests
|
|||||||
|
|
||||||
class InvoiceNinja(object):
|
class InvoiceNinja(object):
|
||||||
API_V1 = 'api/v1'
|
API_V1 = 'api/v1'
|
||||||
ENDPOINT_URLS = {
|
|
||||||
'clients': 'clients',
|
|
||||||
'products': 'products',
|
|
||||||
'invoices': 'invoices',
|
|
||||||
'recurring invoices': 'recurring_invoices',
|
|
||||||
'payments': 'payments',
|
|
||||||
'quotes': 'quotes',
|
|
||||||
'credits': 'credits',
|
|
||||||
'reports': 'reports',
|
|
||||||
'activities': 'activities',
|
|
||||||
'charts': 'charts',
|
|
||||||
'companies': 'companies',
|
|
||||||
'documents': 'documents',
|
|
||||||
'emails': 'emails',
|
|
||||||
'expense': 'expenses',
|
|
||||||
'export': 'export',
|
|
||||||
'import': 'import_json',
|
|
||||||
'ping': 'ping',
|
|
||||||
'health check': 'health_check',
|
|
||||||
'users': 'users'
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
endpoint_url: str = 'https://invoicing.co',
|
endpoint_url: str = 'https://invoicing.co',
|
||||||
@ -31,19 +10,17 @@ class InvoiceNinja(object):
|
|||||||
self.api_token = api_token
|
self.api_token = api_token
|
||||||
self.headers = dict()
|
self.headers = dict()
|
||||||
|
|
||||||
def _get_url_for(self, endpoint: str = 'ping'):
|
def set_url(url: str):
|
||||||
'''
|
self.endpoint_url = url
|
||||||
Get complete URL for an endpoint.
|
|
||||||
|
|
||||||
Endpoint URLs are appended to the Invoice Ninja base URL
|
def get_url():
|
||||||
and returned.
|
return self.endpoint_url
|
||||||
'''
|
|
||||||
if endpoint in self.ENDPOINT_URLS:
|
|
||||||
return '{}/{}'.format(self.endpoint_url,
|
|
||||||
self.ENDPOINT_URLS[endpoint])
|
|
||||||
|
|
||||||
else:
|
def set_token(token: str):
|
||||||
raise KeyError('Endpoint URL not found')
|
self.api_token = token
|
||||||
|
|
||||||
|
def get_token():
|
||||||
|
return self.api_token
|
||||||
|
|
||||||
#def _get_headers(self, headers: dict = dict()):
|
#def _get_headers(self, headers: dict = dict()):
|
||||||
def build_headers(self):
|
def build_headers(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user