devRaphael13 / py4paystack

MIT License
1 stars 0 forks source link

Error Importing Classes #2

Closed kahlflekzy closed 1 year ago

kahlflekzy commented 1 year ago

Hello, thank you for the great job creating this library.

I have run into some errors without having gone deep. Particularly, I was unable to import Transaction and Paystack. Below are the errors I get.

Case 1 from py4paystack.routes import Transaction

  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
ImportError: cannot import name 'Transaction' from 'py4paystack.routes' (C:\Users\User\Proj\venv\lib\site-packages\py4paystack\routes\__init__.py)

Case 2 from py4paystack import Paystack

  File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
ImportError: cannot import name 'Paystack' from 'py4paystack' (C:\Users\User\Proj\venv\lib\site-packages\py4paystack\__init__.py)

To reproduce,

  1. Create a venv
  2. Run pip install py4paystack
  3. From a python shell, run, from py4paystack.routes import Transaction

On a probably related note, running from py4paystack.routes import transactions yields an error No module named 'dotenv'. I think this module should be included in the package requirements if it is needed.

kahlflekzy commented 1 year ago

Update, after installing python-dotenv, I am now able to use,

>>> from py4paystack.routes import transactions
>>> t = transactions.Transaction(SECRET_KEY)

It appears python-dotenv does not automatically install when pip installing this package. I believe there is a technique to do this, right?

FInally, the documentation says the methods return JSON, in reality, they return a JSON string, which can be decoded into a JSON object in python by the user. Perhaps the documentation should state this more explicitly.

devRaphael13 commented 1 year ago

I have fixed the issues, the imports were as a result of mistake in the documentation.Thank you Kahlflekzy for using my program. Update and enjoy.