beta (#4)
Co-authored-by: mco-system <michael.costa@mcos.nc> Reviewed-on: #4
This commit was merged in pull request #4.
This commit is contained in:
15
src/thsf/backend/__init__.py
Normal file
15
src/thsf/backend/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
||||
import requests
|
||||
import logging
|
||||
|
||||
class Backend:
|
||||
def __init__(self, url, apiprefix, apikey):
|
||||
self.url = url
|
||||
self.apiprefix = apiprefix
|
||||
self.apikey = apikey
|
||||
self.session = requests.Session()
|
||||
|
||||
def get(self, endpoint, params=None):
|
||||
url = f"{self.url}/{self.apiprefix}/{endpoint}"
|
||||
headers = {"Authorization": f"Token {self.apikey}",
|
||||
"Accept": "application/json"}
|
||||
return self.session.get(url, params=params, headers=headers)
|
||||
Reference in New Issue
Block a user