This commit is contained in:
+32
-5
@@ -1,12 +1,39 @@
|
||||
__author__ = 'RemiZOffAlex'
|
||||
__email__ = 'remizoffalex@mail.ru'
|
||||
|
||||
import base64
|
||||
import requests
|
||||
|
||||
|
||||
class Octokit:
|
||||
def __init__(self):
|
||||
self.headers = {}
|
||||
class Client:
|
||||
def __init__(self, url: str, headers: dict = {}, **kwargs):
|
||||
self.url = url
|
||||
self.headers = headers
|
||||
self.kwargs = kwargs
|
||||
|
||||
def _get(self, url, headers: {}):
|
||||
response = requests.get(url, headers).json()
|
||||
def __call__(self, *args, **kwargs):
|
||||
self.kwargs
|
||||
return self
|
||||
|
||||
def get(self, *args, **params):
|
||||
url = self.url
|
||||
if 'node' in self.kwargs:
|
||||
url += f'/{self.kwargs['node']}'
|
||||
response = requests.get(
|
||||
self.url,
|
||||
headers=self.headers
|
||||
)
|
||||
return response.json()
|
||||
|
||||
|
||||
class Octokit:
|
||||
def __init__(self, url: str, headers: dict = {}):
|
||||
self.url = url
|
||||
self.headers = headers
|
||||
|
||||
def __getattr__(self, key):
|
||||
return Client(
|
||||
url=self.url,
|
||||
headers=self.headers,
|
||||
**{'node': key}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user