MCPcopy Index your code
hub / github.com/Rushifakami/csfloat_api / _request

Method _request

csfloat_client.py:78–98  ·  view source on GitHub ↗
(self, method: str, parameters: str, json_data=None)

Source from the content-addressed store, hash-verified

76 raise ValueError(f"Invalid port in proxy URL: {port}")
77
78 async def _request(self, method: str, parameters: str, json_data=None) -> Optional[dict]:
79 if method not in self._SUPPORTED_METHODS:
80 raise ValueError('Unsupported HTTP method.')
81
82 url = f'{_API_URL}{parameters}'
83
84 async with self._session.request(method=method, url=url, ssl=False, json=json_data) as response:
85 if response.status in self.ERROR_MESSAGES:
86 raise Exception(self.ERROR_MESSAGES[response.status])
87
88 if response.status != 200:
89 try:
90 error_details = await response.json()
91 except Exception:
92 error_details = await response.text()
93 raise Exception(f'Error: {response.status}\nResponse Body: {error_details}')
94
95 if response.content_type != 'application/json':
96 raise Exception(f"Expected JSON, got {response.content_type}")
97
98 return await response.json()
99
100 def _validate_category(self, category: int) -> None:
101 if category not in (0, 1, 2, 3):

Callers 15

get_exchange_ratesMethod · 0.95
get_meMethod · 0.95
get_transactionsMethod · 0.95
get_account_standingMethod · 0.95
get_locationMethod · 0.95
get_pending_tradesMethod · 0.95
get_similarMethod · 0.95
get_buy_ordersMethod · 0.95
get_my_buy_ordersMethod · 0.95
get_salesMethod · 0.95
get_all_listingsMethod · 0.95
get_specific_listingMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected