#🔒 No module named 'requests.cookies' when importing requests

10 messages · Page 1 of 1 (latest)

dire snow
#

Hello! Python noob here. My script needs to check if a string exists in a websites source code: this is what I have so far:

`import requests
import urllib3

request = requests.get('example.com')
if ("test" in request.text):
print("String found")
else:
print("String not found")`

however, importing requests yields this error:
Traceback (most recent call last): File "C:\Users\PC\Documents\script.py", line 9, in <module> import requests File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\requests\__init__.py", line 133, in <module> from . import utils File "C:\Users\PC\AppData\Roaming\Python\Python39\site-packages\requests\utils.py", line 35, in <module> from .cookies import cookiejar_from_dict ModuleNotFoundError: No module named 'requests.cookies'

any help would be appreciated!

worthy salmonBOT
#

@dire snow

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

gentle wharf
#

pip install requests

midnight pagoda
#

pip install --upgrade --force-reinstall requests

dire snow
midnight pagoda
#

No worries!

gentle wharf
worthy salmonBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.