You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to make order butgot error Invalid L1 Request headers. I make som orders with web and all is okay
`import os
from py_clob_client.constants import POLYGON
from py_clob_client.client import ClobClient
from py_clob_client.clob_types import OrderArgs
from py_clob_client.order_builder.constants import BUY
from dotenv import load_dotenv
`Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\client.py", line 218, in create_or_derive_api_creds
return self.create_api_key(nonce)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\client.py", line 180, in create_api_key
creds_raw = post(endpoint, headers=headers)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\http_helpers\helpers.py", line 54, in post
return request(endpoint, POST, headers, data)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\http_helpers\helpers.py", line 42, in request
raise PolyApiException(resp)
py_clob_client.exceptions.PolyApiException: PolyApiException[status_code=401, error_message={'error': 'Invalid L1 Request headers'}]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\polymarket\test.py", line 17, in
client.set_api_creds(client.create_or_derive_api_creds())
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\client.py", line 220, in create_or_derive_api_creds
return self.derive_api_key(nonce)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\client.py", line 201, in derive_api_key
creds_raw = get(endpoint, headers=headers)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\http_helpers\helpers.py", line 58, in get
return request(endpoint, GET, headers, data)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\http_helpers\helpers.py", line 42, in request
raise PolyApiException(resp)
py_clob_client.exceptions.PolyApiException: PolyApiException[status_code=401, error_message={'error': 'Invalid L1 Request headers'}]
`
The text was updated successfully, but these errors were encountered:
Overview
Try to use the basic script to make orders
Description
I want to make order butgot error Invalid L1 Request headers. I make som orders with web and all is okay
`import os
from py_clob_client.constants import POLYGON
from py_clob_client.client import ClobClient
from py_clob_client.clob_types import OrderArgs
from py_clob_client.order_builder.constants import BUY
from dotenv import load_dotenv
load_dotenv(dotenv_path='.env')
host = "https://clob.polymarket.com"
key = os.getenv("PK1")
print(key)
chain_id = POLYGON
Create CLOB client and get/set API credentials
client = ClobClient(host, key=key, chain_id=chain_id)
client.set_api_creds(client.create_or_derive_api_creds())
resp = client.create_and_post_order(OrderArgs(
price=0.50,
size=100.0,
side=BUY,
token_id="71321045679252212594626385532706912750332728571942532289631379312455583992563"
))
print(resp)`
Notes
`Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\client.py", line 218, in create_or_derive_api_creds
return self.create_api_key(nonce)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\client.py", line 180, in create_api_key
creds_raw = post(endpoint, headers=headers)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\http_helpers\helpers.py", line 54, in post
return request(endpoint, POST, headers, data)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\http_helpers\helpers.py", line 42, in request
raise PolyApiException(resp)
py_clob_client.exceptions.PolyApiException: PolyApiException[status_code=401, error_message={'error': 'Invalid L1 Request headers'}]
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\user\PycharmProjects\polymarket\test.py", line 17, in
client.set_api_creds(client.create_or_derive_api_creds())
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\client.py", line 220, in create_or_derive_api_creds
return self.derive_api_key(nonce)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\client.py", line 201, in derive_api_key
creds_raw = get(endpoint, headers=headers)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\http_helpers\helpers.py", line 58, in get
return request(endpoint, GET, headers, data)
File "C:\Users\user\PycharmProjects\polymarket.venv\lib\site-packages\py_clob_client\http_helpers\helpers.py", line 42, in request
raise PolyApiException(resp)
py_clob_client.exceptions.PolyApiException: PolyApiException[status_code=401, error_message={'error': 'Invalid L1 Request headers'}]
`
The text was updated successfully, but these errors were encountered: