I just installed the Requests module by using easy_install
and I tried to run the demo code of this tutorial,
import requests payload = {'username': 'xxxx', 'password': 'xxxxx'} r = requests.get('https://github.com/timeline.json')
but I get this error:
AttributeError:
'module' object has no attribute 'get'
To solve the Python "AttributeError: module has no attribute", make sure you haven't named your local modules with names of remote modules, e.g. datetime.py or requests.py and remove any circular dependencies in import statements.
It's simply because there is no attribute with the name you called, for that Object. This means that you got the error when the "module" does not contain the method you are calling.
This is the typical symptom of an unrelated requests.py
(or requests.pyc
) file sitting in your current directory, or somewhere else on the PYTHONPATH
. If this is the case, remove or rename it, as it's shadowing the module you really want to import.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With