added gitignore

This commit is contained in:
Andrew Bryant 2023-12-17 10:32:33 -05:00
parent c56243589b
commit e14328c68b
2 changed files with 10 additions and 32 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
__pycache__

View File

@ -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):