sample python code to generate the auth token with password ?

Can some one please provide sample python code to generate the auth token with password ? Can you please suggest how to set password so that I can use the session object obtained like below to generate bearer token

session=accessToken.SessionModel(client_id=app_id,

Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  Ā  secret_key=api_secret,redirect_uri=redirect_uri,response_type='code', grant_type='authorization_code')

s = requests.Session()

Ā  Ā  Ā  Ā  Ā  Ā  data1 = f'{{"fy_id":"{login_id}","password":"{password}","app_id":"2","imei":"","recaptcha_token":""}}'

Ā  Ā  Ā  Ā  Ā  Ā  r1 = s.post('https://api.fyers.in/vagator/v1/login', data=data1)

Ā  Ā  Ā  Ā  Ā  Ā  request_key = r1.json()["request_key"]


Ā 

3 replies