Beispiel #1
0
    def __init__(self, account: BUXAccount = None):
        self.config = BUXApiConfig()

        if account is None:
            account = BUXAccount.get_account()

        self.access_token = account.login()
Beispiel #2
0
    def delete(self, query: str):
        headers = BUXApiConfig.get_bearer_headers(self.access_token)

        url = BUXApiConfig.base_endpoint_url + query
        request = requests.delete(url, headers=headers)
        print(request)
        print(request.json())
Beispiel #3
0
    def post(self, query: str, data: dict) -> str:
        headers = BUXApiConfig.get_bearer_headers(self.access_token)

        url = BUXApiConfig.base_endpoint_url + query
        request = requests.post(url, json=data, headers=headers)
        return request.json()
Beispiel #4
0
    def put_with_data(self, query: str, data: dict):
        headers = BUXApiConfig.get_bearer_headers(self.access_token)

        url = BUXApiConfig.base_endpoint_url + query
        request = requests.put(url, json=data, headers=headers)
        print(request.json())
Beispiel #5
0
    def put(self, query: str):
        headers = BUXApiConfig.get_bearer_headers(self.access_token)

        url = BUXApiConfig.base_endpoint_url + query
        requests.put(url, headers=headers)
Beispiel #6
0
    def stats_query_with_data(self, query: str, data: dict) -> str:
        headers = BUXApiConfig.get_bearer_headers(self.access_token)

        url = "https://api.getbux.com/stats/2/graph/" + query
        request = requests.get(url, headers=headers, params=data)
        return request.json()
Beispiel #7
0
    def query_with_data(self, query: str, data: dict) -> str:
        headers = BUXApiConfig.get_bearer_headers(self.access_token)

        url = BUXApiConfig.base_endpoint_url + query
        request = requests.get(url, headers=headers, params=data)
        return request.json()
Beispiel #8
0
    def query(self, query: str) -> str:
        headers = BUXApiConfig.get_bearer_headers(self.access_token)

        url = BUXApiConfig.base_endpoint_url + query
        request = requests.get(url, headers=headers)
        return request.json()