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).

1. 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()


2. Replaced conn host with fyers host (conn = http.client.HTTPSConnection("api.fyers.in"))

throwing "503 Service Temporarily Unavailable"

3. 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.