OpenApi-5p / py5paisa

Official Python SDK for 5paisa APIs natively written in VB .NET
https://5paisa.github.io
89 stars 65 forks source link

'NoneType' object is not subscriptable error when trying login api #181

Open MohanSK82 opened 2 years ago

MohanSK82 commented 2 years ago

issue

I just started to get an hands-on with also api's and struck at login stage itself. I am getting 'NoneType' object is not subscriptable error when trying login api. I tried this on both windows and ubuntu OS but same error. As per my knowledge python, py5paisa packages are latest one.

What I Did

Following is the code snippet I am running from Jupyter. cred details and login details are correct (verified multiple times)

from py5paisa import FivePaisaClient cred={ "APP_NAME":"YOUR APP_NAME", "APP_SOURCE":"YOUR APP_SOURCE", "USER_ID":"YOUR USER_ID", "PASSWORD":"YOUR PASSWORD", "USER_KEY":"YOUR USERKEY", "ENCRYPTION_KEY":"YOUR ENCRYPTION_KEY" }

client = FivePaisaClient(email="myemail@gmail.com", passwd="my-password", dob="yyyymmdd", cred=cred) client.login()

Looking for any support here to fix the issue. Thanks in advance

-Mohan

5paisa commented 2 years ago

Please share this details over mail to our support team.

support@5paisa.com

shivjeetbhullar commented 2 years ago

Same Issue

MonkeyBusiness4 commented 2 years ago

I was facing the same problem, try updating your python. Worked for me.

bhaskar-c commented 2 years ago

Same issue here. The credentials are correct. Upon digging into your code in file py5paisa.py the response returned from this line:

res = self._login_request(self.LOGIN_ROUTE) is None

The response is: {'body': None, 'head': {'responseCode': '5PLoginV4', 'status': '2', 'statusDescription': 'Invalid head parameters.'}}

The parameters are exactly defined as shown in your readme example and the credentials are as provided.

Since your Python code does not mention any version I wonder what version of your API am I currently using.