Closed Masquerade64 closed 12 months ago
Thanks for opening up the issue. I made a mistake by thinking that the requests module is part of the standard library, but it is in fact an external module. I added a requirements.txt and edited the README.
You can install the requests module by using either of these two approaches:
pip install requests
pip install -r requirements.txt
For Python3 use pip3 instead.
I'm not sure what's going on, but i had the issue that was raised, but even after trying both of the commands mentioned above, it still says:
import requests
ModuleNotFoundError: No module named 'requests'
I verified that the module was installed (which it was) and i could uninstall it to try each method.
That's a common hiccup when your Python setup struggles to find the installed modules. I don't know what your setup is, but you could try running it with "python main.py" instead of "python3 main.py". This answer on StackOverflow also provides good guidance. Another option is to use virtual enviroments for Python, you can find the documentation here and a good answer in post on StackOverflow. They explain it better than I could.
Also, if you are using Python3, you should use pip3.
Got further but both my windows installation an dlinux both now say the following:
Request failed: Expecting value: line 1 column 1 (char 0)
I only have python3 & pip3 installed on each of these. Not sure if that helps.
That certainly is a step further! It seems like the json response from the API is not correct, which I haven't encountered before. Can you try to print the "response.text" in PYxREL -> APIHelper.py? I'd put it directly under line 13, which is 'response = requests.get(api_url, params=parameters)'. I also made a new commit and changed the error handling a bit, which hopefully gives more information.
Sorry, I don't code or script - so I'm not exactly sure what you'd like me to do with \discord-predb-main\PYxREL\APIHelper.py
Apologies if this is frustrating, hopefully other users will find this useful though.
No problem! I made a new commit that will print the response.text for you in the error message. Just grab the new code, or only the new PYxREL folder, from the repo and let me know what the new error message is.
Cool, thanks!
I now see this:
Invalid response format: Expecting value: line 1 column 1 (char 0) Response content: <!DOCTYPE html>
How weird! It seems xREL has implemented additional security measures using Javascript. That might be due to rate limiting or IP blocking. Have .json files been created in the directory where main.py is located? If they are there, are they filled with content?
nope, no .jason file in there. by the way, is it possible to customize feeds easily, for things like movies, or would that require af fundamental code change?
i don't get the error when disabling my VPN,i suppose it must be that. i don't see anything appear in discord yet, although it might need a new release to report first?
Yeah, it must be the VPN! They state in their documentation "Important info: due to abusive requests to xrel.to, we had to block some IP ranges including some VPN providers. If this is a problem for you, please use https://xrel-api.nfos.to/ to access the API instead of https://api.xrel.to/.". Glad it works now though!
Yes, the first time there won't be a message, because it does an intial scan, so it does need a new release. But you can run test.py and should get a message to your webhooks immediately to cofirm everything works.
I suffer this problem when attempting to run the file with python. Is there something I am doing incorrectly?
`main.py
Traceback (most recent call last): File "D:\Downloads\discord-predb-main\main.py", line 4, in
from PYxREL import xREL
File "D:\Downloads\discord-predb-main\PYxREL__init__.py", line 1, in
from .xREL import xREL
File "D:\Downloads\discord-predb-main\PYxREL\xREL.py", line 1, in
from .APIHelper import APIHelper
File "D:\Downloads\discord-predb-main\PYxREL\APIHelper.py", line 1, in
import requests
ModuleNotFoundError: No module named 'requests'`