Login Trouble in accesing Fyers V3 API. JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Dear Fyers Developer Community,

I hope this message finds you well. I'm reaching out to seek assistance with a coding issue I've encountered, and I'd greatly appreciate any guidance or suggestions you may have.

JSONDecodeError: Expecting value: line 1 column 1 (char 0)


from fyers_apiv3 import fyersModel

"""
In order to get started with Fyers API we would like you to do the following things first.
1. Checkout our API docs :   https://myapi.fyers.in/docsv3
2. Create an APP using our API dashboard :   https://myapi.fyers.in/dashboard/

Once you have created an APP you can start using the below SDK
"""

#### Generate an authcode and then make a request to generate an accessToken (Login Flow)
## app_secret key which you got after creating the app

grant_type = "authorization_code"                  ## The grant_type always has to be "authorization_code"
response_type = "code"                             ## The response_type always has to be "code"
state = "sample"                                   ##  The state field here acts as a session manager. you will be sent with the state field after successfull generation of auth_code

### Connect to the sessionModel object here with the required input parameters
appSession = fyersModel.SessionModel(client_id = client_id, redirect_uri = redirect_uri,response_type=response_type,state=state,secret_key=secret_key,grant_type=grant_type)

# ## Make  a request to generate_authcode object this will return a login url which you need to open in your browser from where you can get the generated auth_code
generateTokenUrl = appSession.generate_authcode()
generateTokenUrl

from datetime import datetime, timedelta, date
from  time import sleep
import os
import pyotp
import requests
import json
import math
import pytz
from urllib.parse import parse_qs,urlparse
import warnings
import pandas as pd

pd.set_option('display.max_columns', None)
warnings.filterwarnings('ignore')

import base64
def getEncodedString(string):
    string = str(string)
    base64_bytes = base64.b64encode(string.encode("ascii"))
    return base64_bytes.decode("ascii")

URL_SEND_LOGIN_OTP="https://api-t2.fyers.in/vagator/v2/send_login_otp_v2"
res = requests.post(url=URL_SEND_LOGIN_OTP, json={"fy_id":getEncodedString(FY_ID),"app_id":"2"}).json()
print(res)

Same error for me as well.

@LYddsM1o69 I hope they sort it out asap. Let’s wait it out

Getting the same error, Although my code was working fine for me but today it’s giving this error.

Could it be because of this : https://www.isitdownrightnow.com/api-t1.fyers.in.html

@kf6q5d206L Thanks for the insight. It shows fyers api is down for everyone.

Hey @rishabh_sahni

There was an issue with the auto login which is fixed now , please check

This is crazy, happens middle of trading hours.