#app_id = "QH7V9X2X1J-100"
#app_secret = "62FZ9B3WWB"
redirect_url = "https://www.google.com"
#system pip install fyers_api,
from fyers_api import fyersModel, accessToken
app_id = open('app_id.txt','r').read()
app_secret = open('app_secret.txt','r').read()
app_session = accessToken.SessionModel(app_id ,app_secret)
response = app_session.auth()
print(response)
I am trying to generate auth code but getting error as follows: {'code': '500', 'data': JSONDecodeError('Expecting value: line 1 column 1 (char 0)')}
Process finished with exit code 0
Pls guide.
I am trying to generate auth code but getting error as follows: {'code': '500', 'data': JSONDecodeError('Expecting value: line 1 column 1 (char 0)')}
Process finished with exit code 0
Pls guide.
Where am I?
In FYERS Community - Pick others' brains on Trading/Investing you can ask and answer questions and share your experience with others!
try this
app_id = "your id"
app_secret = "your app secret"
redirect_url = "http://google.com/"
from fyers_api import fyersModel, accessToken
session=accessToken.SessionModel(client_id=app_id,secret_key=app_secret,redirect_uri=redirect_url,response_type="code", grant_type="authorization_code")
response = session.generate_authcode()
print("Login URL:", response)
auth_code = input("Enter Aut Code:")
#auth_code = ""
session.set_token(auth_code)
response = session.generate_token()
#return access_token
print(response)
It is not working ..
What can be done?
Hey ankitha,
can you check if you installed the latest version of fyers,
pip install fyers-apiv2
I'll attach the code i use for generating auth code,
from fyers_api import accessToken
client_id = "SPXXXXE7-100"
secret_key = "N********B"
redirect_uri = "https://trade.fyers.in/api-login/redirect-uri/index.html"
response_type = "code"
state = "sample_state"
session=accessToken.SessionModel(
client_id=client_id,
secret_key=secret_key,
redirect_uri=redirect_uri,
response_type=response_type
)
response = session.generate_authcode()
print(response)
I
Getting above errors!
Getting above concern as well. How to resolve.
Take a look at this,
https://stackoverflow.com/questions/67150436/cannot-be-loaded-because-running-scripts-is-disabled-on-this-system-for-more-in
Sir, still getting following error:
can you enter the command pip list and see the version of fyers-api installed,
It should be the latest 2.0.5
it is latest one..Pls suggest
do one thing, create a new virtual environment,
execute only this pip command,
pip install fyers-apiv2==2.0.5
and try executing your program, I feel there is clash between the different versions of fyers api installed on your system.
Hii Vikram Sri,
How to resolve this now:
Hey, above code I sent is for auth code generation,
Below code is code access token generations,
from fyers_api import accessToken
client_id = "SPXXXXE7-100"
secret_key = "N********B"
redirect_uri = "https://trade.fyers.in/api-login/redirect-uri/index.html"
response_type = "code"
grant_type = "authorization_code"
auth_code = "eyJ0eXAi*******.eyJpc3MiOiJhcGkubG9********.r_65Awa1kGdsNTAgD******"
session = accessToken.SessionModel(
client_id=client_id,
secret_key=secret_key,
redirect_uri=redirect_uri,
response_type=response_type,
grant_type=grant_type
)
session.set_token(auth_code)
response = session.generate_token()
print(response)
getting this error
There are very good videos on YT about this topic. please go through them. they could be very helpful