Restoration of API Limit

Hi,

I received that API Excess Limit Reached on Sunday, so its Monday today but while trying to connect with the API I am getting the following error message. I was hoping this wouldn’t be because of API Limit as its the next day and the Auth Code is generated fine, nevertheless, I was wondering when is the API Limit is Reset in IST?

Thanks!

Reference of API Limit on Sunday

facing same issue i think generate token is not working

Auto login error :

from fyers_apiv3 import fyersModel
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
import numpy as np
import kiteapp as kt
import talib
import time

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()   
if datetime.now().second % 30 > 27 : sleep(5)
URL_VERIFY_OTP="https://api-t2.fyers.in/vagator/v2/verify_otp"
res2 = requests.post(url=URL_VERIFY_OTP, json= {"request_key":res["request_key"],"otp":pyotp.TOTP(TOTP_KEY).now()}).json()  
ses = requests.Session()
URL_VERIFY_OTP2="https://api-t2.fyers.in/vagator/v2/verify_pin_v2"
payload2 = {"request_key": res2["request_key"],"identity_type":"pin","identifier":getEncodedString(PIN)}
res3 = ses.post(url=URL_VERIFY_OTP2, json= payload2).json()  
ses.headers.update({
    'authorization': f"Bearer {res3['data']['access_token']}"
})
TOKENURL="https://api-t1.fyers.in/api/v3/token"
payload3 = {"fyers_id":FY_ID,
           "app_id":client_id[:-4],
           "redirect_uri":redirect_uri,
           "appType":"100","code_challenge":"",
           "state":"None","scope":"","nonce":"","response_type":"code","create_cookie":True}
res3 = ses.post(url=TOKENURL, json= payload3).json()  
url = res3['Url']
parsed = urlparse(url)
auth_code = parse_qs(parsed.query)['auth_code'][0]
grant_type = "authorization_code" 
response_type = "code"  
session = fyersModel.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()
access_token = response['access_token']

fyerss = fyersModel.FyersModel(client_id=client_id, is_async=False, token=access_token, log_path=os.getcwd())
fyerss.get_profile()
  Traceback (most recent call last)
File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py:971, in Response.json(self, **kwargs)
    970 try:
--> 971     return complexjson.loads(self.text, **kwargs)
    972 except JSONDecodeError as e:
    973     # Catch JSON-related errors and raise as requests.JSONDecodeError
    974     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\simplejson\__init__.py:514, in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, allow_nan, **kw)
    510 if (cls is None and encoding is None and object_hook is None and
    511         parse_int is None and parse_float is None and
    512         parse_constant is None and object_pairs_hook is None
    513         and not use_decimal and not allow_nan and not kw):
--> 514     return _default_decoder.decode(s)
    515 if cls is None:

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\simplejson\decoder.py:386, in JSONDecoder.decode(self, s, _w, _PY3)
    385     s = str(s, self.encoding)
--> 386 obj, end = self.raw_decode(s)
    387 end = _w(s, end).end()

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\simplejson\decoder.py:416, in JSONDecoder.raw_decode(self, s, idx, _w, _PY3)
    415         idx += 3
--> 416 return self.scan_once(s, idx=_w(s, idx).end())

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

During handling of the above exception, another exception occurred:

JSONDecodeError                           Traceback (most recent call last)
Cell In[17], line 27
     25     return base64_bytes.decode("ascii")
     26 URL_SEND_LOGIN_OTP="https://api-t2.fyers.in/vagator/v2/send_login_otp_v2"
---> 27 res = requests.post(url=URL_SEND_LOGIN_OTP, json={"fy_id":getEncodedString(FY_ID),"app_id":"2"}).json()   
     28 print (res)
     29 # if datetime.now().second % 30 > 27 : sleep(5)
     30 # URL_VERIFY_OTP="https://api-t2.fyers.in/vagator/v2/verify_otp"
     31 # res2 = requests.post(url=URL_VERIFY_OTP, json= {"request_key":res["request_key"],"otp":pyotp.TOTP(TOTP_KEY).now()}).json()  
   (...)
     62 # fyerss = fyersModel.FyersModel(client_id=client_id, is_async=False, token=access_token, log_path=os.getcwd())
     63 # fyerss.get_profile()

File ~\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\models.py:975, in Response.json(self, **kwargs)
    971     return complexjson.loads(self.text, **kwargs)
    972 except JSONDecodeError as e:
    973     # Catch JSON-related errors and raise as requests.JSONDecodeError
    974     # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975     raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

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

Same error auto login not working from yesterday …

I’m also facing same issue

same here. getting the below error.

Error generating Access Token Expecting value: line 1 column 1 (char 0)

Still facing the same issue, unable to connect to AlgoTest as well.

I’m facing the same issue currently. My code worked just fine till last weekend.

API access token generation was down in the morning, so the API counter limit might not be refreshed in the morning session. Try now its working…

Hey @105254772856376875797

Could you check now if you’re facing the same issue

Hi @WWhYB2qrsx

It is working now, but could you provide the information regarding the time for reset?

Everyday at 12am we reset the rate limits .