py5paisa icon indicating copy to clipboard operation
py5paisa copied to clipboard

unable to do authentication

Open ankitcs08 opened this issue 5 years ago • 21 comments

  • 5paisa Python SDK version:0.1.6
  • Python version:3.7.7
  • Operating System:Win10

Description

I just configure the keys.conf file and tried executing client.login() but it ended up with below error : Traceback (most recent call last): File "main_paisa.py", line 4, in client.login() File ".................\py5paisa\py5paisa.py", line 51, in login message = res["body"]["Message"] TypeError: 'NoneType' object is not subscriptable

Please note: I have configured keys.conf file without quotes and provided proper input to FivePaisaClient() like below: client = FivePaisaClient(email="[email protected]", passwd="xxxxxxx", dob="yyyymmdd")

ankitcs08 avatar Oct 06 '20 17:10 ankitcs08

@ankitcs08 please recheck u have configured correctly, i tried simulating but couldn't recreate this error... I am able to login without any issue...

also recheck you are using latest py5paisa code..

ghost avatar Oct 06 '20 18:10 ghost

I am too getting the same error message:

TypeError: 'NoneType' object is not subscriptable

adish1501 avatar Nov 06 '20 19:11 adish1501

I have opened an account with them recently and facing the same issue. Digging into the code I figured that the API response received is: {"body":null,"head":{"responseCode":"5PLoginV2","status":"2","statusDescription":"Invalid head parameters."}} This response is insufficient to figure out what parameter could be incorrect or if the account does not have access to the APIs. I have also tried using the login API(https://www.5paisa.com/developerapi/userlogin) directly to no avail. There is supposedly a newer version(V3 as against V2 used by the python and go APIs). Interestingly, the new API returns success but does not return a valid body: { "body": { ... "ClientCode": "", ... }, "head": { "responseCode": "5PLoginV3", "status": "0", "statusDescription": "Success" } } I have written to 5paisa support yesterday but haven't received a response yet. Let's hope they respond soon.

anilgupta83 avatar Nov 26 '20 15:11 anilgupta83

Same issue with me, the body is not valid. Just for confirmation, i edited the LOGIN_ROUTE to "https://Openapi.5paisa.com/VendorsAPI/Service1.svc/V3/LoginRequestMobileNewbyEmail" and self.payload["head"]["requestCode"] = "5PLoginV3" in py5paisa.py

If i execute client.margin() it prints - 'Invalid Input Parameters' despite the success returned on client.login() Is there anything i am missing?

yadipadlakha avatar Nov 28 '20 10:11 yadipadlakha

I encountered a similar issue with golang API as reported here

sunnylbk avatar Dec 02 '20 17:12 sunnylbk

I am getting the same issue

Traceback (most recent call last): File "C:\demo\5paisa-python\auth.py", line 4, in client.login() File "C:\Users\nmahajan\AppData\Roaming\Python\Python39\site-packages\py5paisa\py5paisa.py", line 51, in login message = res["body"]["Message"] TypeError: 'NoneType' object is not subscriptable

n1ftyn1k avatar Jan 17 '21 08:01 n1ftyn1k

@bugf1nd3r @sunnylbk @yadipadlakha @anilgupta83 @ankitcs08 @adish1501 I have fixed the login issue in a new release. Please install the latest release using pip install py5paisa==0.1.8. If it fixes your issue, please close this issue or else mention me here. Thanks! :tada:

ba11b0y avatar Mar 28 '21 09:03 ba11b0y

@bugf1nd3r @sunnylbk @yadipadlakha @anilgupta83 @ankitcs08 @adish1501 I have fixed the login issue in a new release. Please install the latest release using pip install py5paisa==0.1.8. If it fixes your issue, please close this issue or else mention me here. Thanks!

Still getting error in 0.1.8

Sushantmkarande avatar Apr 29 '21 13:04 Sushantmkarande

I am facing the same issue

harshudasi avatar Dec 21 '21 22:12 harshudasi

What is the error after the latest release?

Parthiban-Sampath avatar Dec 22 '21 02:12 Parthiban-Sampath

client.login() 14:55:42 | Invalid Input Parameters.

Unable to login from python code

arunachalam622 avatar Mar 03 '22 09:03 arunachalam622

I am facing the same issue

have u resolved the issue?

arunachalam622 avatar Mar 03 '22 09:03 arunachalam622

Am getting the same error :(

deepakkshr avatar Mar 23 '22 20:03 deepakkshr

I am also facing the same issue. this is what I am getting in response at _lognrequest() in py5paisa.py file {"body":null,"head":{"responseCode":"5PLoginV4","status":"2","statusDescription":"Invalid head parameters."}}

I checked all the parameters 5-6 time, even used copy menthod but still facing the same issue. here is the code:

from py5paisa import FivePaisaClient email="anit********.com" pwd="v*****09" dob="1901"

cred={ "APP_NAME": "5P53046136", "APP_SOURCE":"9911", "USER_ID":"X1nzoWbOOUT", "PASSWORD":"6Ta3", "USER_KEY":"ric0LtaSefX5tTO", "ENCRYPTION_KEY":"ISjHPx**1ip6Ro" }

client = FivePaisaClient(email=email, passwd=pwd, dob=dob,cred=cred) client.login()

This is the final response I get after client.login()

17:36:16 | 'NoneType' object is not subscriptable 17:36:16 | 'NoneType' object is not subscriptable

Please Help.

Thanks

pareshkhokhar avatar May 21 '22 12:05 pareshkhokhar

I'm facing the same error, wondering if the 5Paisa team has resolution for this..!?

Sathipoo avatar Jun 07 '22 11:06 Sathipoo

Facing the same issue

akheelsajjan avatar Oct 20 '22 03:10 akheelsajjan

They have a new Authentication System: AUTHENTICATION USING OAUTH. As per them, "we have deprecated the existing method which involved the use of login credentials. Kindly go through this updated documentation of using Access token for API Access".

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" }

First get a token by logging in to -> https://dev-openapi.5paisa.com/WebVendorLogin/VLogin/Index?VendorKey=<Your Vendor Key>&ResponseURL=<Redirect URL>

VendorKey is UesrKey for individuals user

for e.g. you can use ResponseURL as https://www.google.com/

Pass the token received in the response url after successful login to get an access token (this also sets the token for all the APIs you use)-

Please note that you need to copy the request token from URL and paste in this code and start the code within 30s.

#This function will automatically take care of generating and sending access token for all your API's

client = FivePaisaClient(cred=cred) client.get_access_token('Your Response Token')

After successful authentication, you should get a Logged in!! message

### HOWEVER IT IS NOT WORKING

srathsail avatar Oct 23 '22 11:10 srathsail

getting same error 12:56:53 | Invalid Response Token. 12:56:53 | 'NoneType' object is not subscriptable 12:56:53 | 'NoneType' object is not subscriptable

my code 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(cred=cred) client.get_access_token('Your Response Token') client = FivePaisaClient(email="[email protected]", passwd="Password", dob="YYYYMMDD",cred=cred) client.login()

hari134 avatar Feb 06 '23 07:02 hari134

Is there any updates regarding the login issue with the email, password, dob and credentials.

I am getting the response message as None while doing the client.login().

I have checked the credentials and the password multiplt times. Still not able to resolve

mhdSharuk avatar Feb 13 '23 17:02 mhdSharuk

is anyone able to resolve this issue ? both username , password and OAuth is not working for me

lakhtomillion avatar May 04 '23 17:05 lakhtomillion