Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPError: 401 Client Error: Unauthorized for url: https://testnet-api.delta.exchange/v2/positions?product_id=27 #46

Open
akumar1503 opened this issue Mar 2, 2024 · 4 comments

Comments

@akumar1503
Copy link

akumar1503 commented Mar 2, 2024

I'm getting below error on using python client, I've already whitelisted my ip (from http://whatismyipaddress.com) and used the api keys as mentioned on readme.

Below is the call being made and error I'm getting, in client I can already see auth=True is passed.

delta_client.get_position(27)

Traceback (most recent call last):
File "", line 1, in
File "/venv_p3/lib/python3.11/site-packages/delta_rest_client/delta_rest_client.py", line 138, in get_position
response = self.request(
^^^^^^^^^^^^^
File "/venv_p3/lib/python3.11/site-packages/delta_rest_client/delta_rest_client.py", line 68, in request
res.raise_for_status()
File "/venv_p3/lib/python3.11/site-packages/requests/models.py", line 943, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://testnet-api.delta.exchange/v2/positions?product_id=27

@akumar1503
Copy link
Author

Discussed with PM, a work around:
Whitelisting IPv6 address worked for me.

@18patti
Copy link

18patti commented Jun 1, 2024

Hi
I whitelisted my ipv4 address but still the error is throwing. I checked the api key and secret are valid as well.

line 21, in
order_response = delta_client.place_order(
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\delta_rest_client\delta_rest_client.py", line 234, in place_order
return self.create_order(order)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\delta_rest_client\delta_rest_client.py", line 91, in create_order
response = self.request('POST', "/v2/orders", order, auth=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\delta_rest_client\delta_rest_client.py", line 68, in request
res.raise_for_status()
File "C:\Python312\Lib\site-packages\requests\models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.delta.exchange/v2/orders

Thanks

@Chap92
Copy link

Chap92 commented Jun 1, 2024

Hi I whitelisted my ipv4 address but still the error is throwing. I checked the api key and secret are valid as well.

line 21, in order_response = delta_client.place_order( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\delta_rest_client\delta_rest_client.py", line 234, in place_order return self.create_order(order) ^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\delta_rest_client\delta_rest_client.py", line 91, in create_order response = self.request('POST', "/v2/orders", order, auth=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\delta_rest_client\delta_rest_client.py", line 68, in request res.raise_for_status() File "C:\Python312\Lib\site-packages\requests\models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.delta.exchange/v2/orders

Thanks

You need to add both IPV6 and IPV4 addresses, in that order (IPV6 address,IPV4 address)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants