Can I use Requests library in a Python Worker
Ok, I don't remember where I read it, but I thought I could use the
Requests
library to do GET and POST requests.
But, I'm getting ModuleNotFoundError: No module named 'requests'
error.4 Replies
No. You can use something like aiohttp or httpx
FOUND IT
Here it mentions
requests: 2.31.0
https://developers.cloudflare.com/workers/languages/python/packages/
Does that not mean that it can support it, or am I doing a very obviously dumb thing...Cloudflare Docs
Python packages supported in Cloudflare Workers · Cloudflare Worker...
You can currently only use built-in packages in local development. Support for deploying packages with a requirements.txt file is coming soon.
THE PLOT THICKENS, haha... I have no idea what I'm doing lol
So, this error occurs when I put
requests
in requirements.txt
. Doesn't matter if I import requests or not.
Ok... No matter whatever package I put in requirements.txt
it still gives me that.
This is the code in index.py
And this is what's in requirements.txt
And this is the Error