Add modules: api, operations, routes with org display
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import requests
|
||||
|
||||
|
||||
class HttpClient:
|
||||
def __init__(self, endpoint, token):
|
||||
self._endpoint = endpoint.rstrip("/")
|
||||
self._session = requests.Session()
|
||||
self._session.headers.update({
|
||||
"Authorization": f"Bearer {token}",
|
||||
"User-Agent": "Mozilla/5.0",
|
||||
})
|
||||
|
||||
def get(self, path, **kwargs):
|
||||
kwargs.setdefault("timeout", 10)
|
||||
r = self._session.get(f"{self._endpoint}{path}", **kwargs)
|
||||
r.raise_for_status()
|
||||
return r.json()
|
||||
Reference in New Issue
Block a user