我安装了请求包,但是当我开始使用它时,我收到了这个错误:
AttributeError: 'module' object has no attribute 'get'
这是我的代码:
from bs4 import BeautifulSoup
import requests
r = requests.get("http://someSite.com/path")
我检查了一些解决这个问题的方法,其中大多数都说导入包有错误,或者当前目录中存在名为requests.py的文件,但对我来说情况并非如此
我遇到这个错误已经有一段时间了,我坚持了下来。
任何想法?感谢。
更新
完整错误消息
Traceback (most recent call last):
File "parser.py", line 2, in <module>
import requests
File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 52, in <module>
from .packages.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 47, in <module>
from cryptography import x509
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/__init__.py", line 7, in <module>
from cryptography.x509.base import (
File "/usr/local/lib/python2.7/dist-packages/cryptography/x509/base.py", line 14, in <module>
from cryptography.hazmat.primitives.asymmetric import dsa, ec, rsa
File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/primitives/asymmetric/rsa.py", line 14, in <module>
from cryptography.hazmat.backends.interfaces import RSABackend
File "/usr/local/lib/python2.7/dist-packages/cryptography/hazmat/backends/__init__.py", line 7, in <module>
import pkg_resources
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 76, in <module>
import parser
File "/home/lichiheb/Desktop/parser.py", line 4, in <module>
r = requests.get("http://t...content-available-to-author-only...s.com/search-results-jobs/?searchId=1483197031.949&action=search&page=1&view=list")
AttributeError: 'module' object has no attribute 'get'