CoderJoshDK / WIOpy

Walmart Affiliate API Python wrapper
MIT License
11 stars 1 forks source link

Error importing WalmartIO #3

Closed shayan-NECX closed 2 years ago

shayan-NECX commented 2 years ago

Trying to run the code, but it gives error on first line. Can you help ?

from WIOpy import WalmartIO

wiopy = WalmartIO(private_key_version='1', private_key_filename='./WM_IO_private_key.pem', consumer_id='XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') data = wiopy.product_lookup('33093101')[0]


TypeError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_17576\2346209252.py in ----> 1 from WIOpy import WalmartIO 2 3 wiopy = WalmartIO(private_key_version='1', private_key_filename='./WM_IO_private_key.pem', consumer_id='XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX') 4 data = wiopy.product_lookup('33093101')[0]

~\Anaconda3\envs\QI_MVP_env\lib\site-packages\WIOpy__init__.py in ----> 1 from .WalmartIO import 2 from .AsyncWIO import

~\Anaconda3\envs\QI_MVP_env\lib\site-packages\WIOpy\WalmartIO.py in 9 from requests.api import request 10 ---> 11 from .arguments import get_items_ids 12 from .errors import 13 from .WalmartResponse import

~\Anaconda3\envs\QI_MVP_env\lib\site-packages\WIOpy\arguments.py in 6 7 ----> 8 def get_items_ids(items: Union[str, list[str]]) -> list[str]: 9 if not isinstance(items, str) and not isinstance(items, list): 10 raise InvalidParameterException('Invalid items argument, it should be a string or List of strings')

TypeError: 'type' object is not subscriptable

CoderJoshDK commented 2 years ago

Hi, I would be happy to help! Can you please give me a little bit more information? What version of python are you running? And while you are at it, can you please provide any other information about the environment this is running on? Thank you

shayan-NECX commented 2 years ago

Hey, I am running the code on Jupyter notebook. Python version is 3.7.13.

shayan-NECX commented 2 years ago

Now that I am running outside Jupyter Notebook, in VS Code, it is giving Error 401

InvalidRequestException: [Request failed] Walmart server answered with the following error: Error. Status code: 401

Even though I have downloaded the .pem private key and the consumer ID from walmart API page. Not sure what is wrong

CoderJoshDK commented 2 years ago

The original error is my mistake. I did not realize that I am using the native list and not List. I will fix it in the next update. In the meantime, WIOpy is only compatible with python>=3.9.

CoderJoshDK commented 2 years ago

As for the authorization, WIO is not great. The instructions are unclear. Please go over their instruction one more time very carefully. After that, if you only recently created the account or uploaded the public key, it is possible you have to wait for an update on their end. Ultimately, I know that the package is still operational because I am actively using it and I re-ran my tests; all still passing. So, the authorization issue is most likely on your end. Redo the steps and/or wait some time for their servers to update with the info you inputted. If the issue still persists, please open a different issue on it

shayan-NECX commented 2 years ago

Yeah, I created account an hour ago. I will try again. Thanks for your help though.