2

I installed the requests package last week and it worked fine.. Until this morning. I coded this and I got the AttributeError: 'module' object has no attribute 'get' message:

import requests

r = requests.get('http://www.yellowpages.com/search?search_terms=coffee&geo_location_terms=Montreal%2C+QC')

I read in other posts that it might be because I have more than one requests packages installed. When I code print(dir(requests)) I get two lists..:

['__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__',
'requests']

['__author__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__',
'requests']

Any help will be appreciated.

Sylvain

2
  • and what does requests.__file__ give you? Commented Jul 15, 2016 at 18:18
  • You called your script requests.py Commented Jul 15, 2016 at 18:37

1 Answer 1

7

Is it possible that you named your script requests.py or that you have a similarly named file in the same directory?

Sign up to request clarification or add additional context in comments.

1 Comment

That's it Alec! I created a requests.py file. I deleted it and now it works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.