can any one share API V2 Python Authorization code and token generation code together.

The V2 Doc is very confusing and not given complete information.

Please help

My Code is

from fyers_api import fyersModel
from fyers_api import accessToken

client_id = open('app_id2.txt','r').read()
secret_key = open('app_secret2.txt','r').read()
redirect_uri='https://trade.fyers.in/api-login/redirect-uri/index.html'

session=accessToken.SessionModel(client_id=client_id,secret_key=secret_key,redirect_uri=redirect_uri,response_type='code',grant_type=None,state=None,scope=None,nonce=None)
response = session.generate_authcode()
#print(response)

auth_code = open('auth_code.txt','r').read()

session.set_token(auth_code)
response = session.generate_token()
print(response)
access_token = response["access_token"]