OpenApi-5p / py5paisa

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

Unable to login. Exception: Please configure your keys in keys.conf #50

Open kumarchinmaya116 opened 3 years ago

kumarchinmaya116 commented 3 years ago

Description

The first time I tried to login, it showed a logged in!! message. But thereafter, I am not able to login. every time i run the script, I get the error: Exception: Please configure your keys in keys.conf. I have saved my keys in keys.conf file as per the instruction and saved the file in the directory where i have kept the script. Still it shows the same error.

What I Did

from py5paisa import FivePaisaClient
client = FivePaisaClient(email="k*****************6@gmail.com", passwd="***********", dob="********")
client.login()
( in place of * i have used my credentials)

The output:
Traceback (most recent call last):

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\site-packages\py5paisa\conf.py", line 9, in <module>
    section = config["KEYS"]

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\configparser.py", line 958, in __getitem__
    raise KeyError(key)

KeyError: 'KEYS'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "<ipython-input-1-7999cee77a8c>", line 1, in <module>
    from py5paisa import FivePaisaClient

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\site-packages\py5paisa\__init__.py", line 1, in <module>
    from py5paisa.py5paisa import FivePaisaClient

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\site-packages\py5paisa\py5paisa.py", line 2, in <module>
    from .auth import EncryptionClient

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\site-packages\py5paisa\auth.py", line 8, in <module>
    from .conf import ENCRYPTION_KEY

  File "C:\Users\dhriti\Anaconda3\envs\trading\lib\site-packages\py5paisa\conf.py", line 11, in <module>
    raise Exception("Please configure your keys in keys.conf")

Exception: Please configure your keys in keys.conf

Has anyone faced similar issue? If so, what can be done?

Regards Chinmaya

coder-amogh commented 3 years ago

Did you read this? Did you try to run through command line? I think the working directory should be the same as where the file is stored.

pawarvijay commented 3 years ago

@coder-amogh @kumarchinmaya116

the api keys link is wrong in documentation i have raised MR for it Here https://github.com/5paisa/py5paisa/pull/58

bpsrinivas commented 3 years ago

File "C:\Users\pbalakr3\IdeaProjects\PythonProjects\src\stockanalysis\5paisa\broker.py", line 1, in from py5paisa import FivePaisaClient File "C:\Users\pbalakr3\IdeaProjects\PythonProjects\venv\lib\site-packages\py5paisa__init__.py", line 1, in from py5paisa.py5paisa import FivePaisaClient File "C:\Users\pbalakr3\IdeaProjects\PythonProjects\venv\lib\site-packages\py5paisa\py5paisa.py", line 3, in from .auth import EncryptionClient File "C:\Users\pbalakr3\IdeaProjects\PythonProjects\venv\lib\site-packages\py5paisa\auth.py", line 8, in from .conf import ENCRYPTION_KEY File "C:\Users\pbalakr3\IdeaProjects\PythonProjects\venv\lib\site-packages\py5paisa\conf.py", line 11, in raise Exception("Please configure your keys in keys.conf") Exception: Please configure your keys in keys.conf

sometimes it works .. then it stops working ... The keys.conf file is present in the same directory

Dhruvt75 commented 3 years ago

i have also same problem can anyone solve this

Parthiban-Sampath commented 3 years ago

First, check the working directory of your program. In the same directory, create keys.conf file with the same format as in https://github.com/5paisa/py5paisa. Then try login.