def __init__(self, account: BUXAccount = None): self.config = BUXApiConfig() if account is None: account = BUXAccount.get_account() self.access_token = account.login()
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())
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()
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())
def put(self, query: str): headers = BUXApiConfig.get_bearer_headers(self.access_token) url = BUXApiConfig.base_endpoint_url + query requests.put(url, headers=headers)
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()
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()
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()