I am trying to generate access code with plain python but running into challenges (Installing 3rd party packages (fyers_api) is a challenge in my prod environment).
- Authorization Headers (from official documentation here, https://myapi.fyers.in/docs/#operation/addpet) throwing failing an error: gaierror: [Errno 11001] getaddrinfo failed .
Code snippet :
import http.client
conn = http.client.HTTPSConnection("curl")
payload = ''
headers = {
'Authorization': f'{api_id}:{access_token}'
}
conn.request("GET", "/", payload, headers)
res = conn.getresponse()
data = [res.read](http://res.read)()
print(data.decode("utf-8"))
- Replaced conn host with fyers host (conn = http.client.HTTPSConnection(“api.fyers.in”))
throwing “503 Service Temporarily Unavailable”
- Authentication & Login steps (reference: https://myapi.fyers.in/docs/#tag/Authentication-and-Login-Flow-User-Apps). Tried to convert below curl to python with postman but it is throwing “format not recognized” error.
Can someone help me to get access code with plain python.