I have a question for Python module AttributeError: module 'requests' has no attribute 'get'

Asked 2 years ago, Updated 2 years ago, 16 views

I'm reading a book by myself and following along. We are currently in the process of importing images from the Internet as a request. I used the requests module and there was an error until installation, but I solved it. On the other hand, as a result of entering url and the following code,

r = requests.get(url, stream=True).raw

An error appears like this.

Traceback (most recent call last):
  File "<pyshell#2>", line 1, in <module>
    r = requests.get(url, stream=True).raw
AttributeError: module 'requests' has no attribute 'get'

As a result of hard googling, this problem occurs when the file name is the same as requests In this case, the problem occurs in an empty shell that has not even been saved.

I have no idea how to solve it. I'd really appreciate your help. I ask you a question politely.

python

2022-09-20 15:38

1 Answers

According to the error message, it seems that you did not import the module after installing it.

import requests

r = requests.get(url, stream=True).raw


2022-09-20 15:38

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.