c0rdis
c0rdis

Reputation: 101

Python "import requests" return AttributeError

I would like to use module 'requests', however, after installation, even importing does not work properly:

Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "requests.py", line 20, in <module>
    r = requests.post(url, data=json.dumps(payload), headers=headers)
AttributeError: 'module' object has no attribute 'post'

Any clue?

Upvotes: 0

Views: 256

Answers (1)

c0rdis
c0rdis

Reputation: 101

Ok, I realized the problem was that my actual filename was requests.py too :D Hope it helps somebody.

Upvotes: 1

Related Questions