Skip to content

Commit

Permalink
Update Request Header
Browse files Browse the repository at this point in the history
This MR adds user agent metadata to the request header
  • Loading branch information
Victor Ramirez committed Oct 15, 2024
1 parent d3a2a14 commit 179a957
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions coinmetrics/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ def run(
on_close = self._on_close

ws = websocket.WebSocketApp(
self.ws_url, on_message=on_message, on_error=on_error, on_close=on_close
self.ws_url, on_message=on_message, on_error=on_error, on_close=on_close,
header={"User-Agent": f"Coinmetrics-Python-API-Client/{version}"}
)
self.ws = ws

Expand Down Expand Up @@ -131,12 +132,12 @@ def __init__(
api_path_prefix = "community-"
self._api_base_url = "https://{}api.coinmetrics.io/v4".format(api_path_prefix)
self._ws_api_base_url = "wss://{}api.coinmetrics.io/v4".format(api_path_prefix)
self._http_header = {"Api-Client-Version": version}
self._http_header = {"User-Agent": f"Coinmetrics-Python-API-Client/{version}"}
self._proxies = {"http": proxy_url, "https": proxy_url}
if session is None:
self._session = requests.Session()
self._session.verify = self._verify_ssl_certs
self._session.headers.update({"Api-Client-Version": version})
self._session.headers.update({"User-Agent": f"Coinmetrics-Python-API-Client/{version}"})
self._session.proxies.update({"http": proxy_url, "https": proxy_url}) # type: ignore
else:
self._session = session
Expand Down

0 comments on commit 179a957

Please sign in to comment.