我安装了https://github.com/muhuk/python-awis以便从alexa获取url信息。我通过从终端运行python setup.py install
来安装它。
当我尝试运行脚本时,会出现以下错误:
Traceback (most recent call last):
File "pst.py", line 4, in <module>
api = AwisApi(ACCESS_ID,SECRET_ACCESS_KEY)
NameError: name 'AwisApi' is not defined
我使用以下代码运行脚本:
api = AwisApi(ACCESS_ID, SECRET_ACCESS_KEY)
tree = api.url_info("www.domain.com", "Rank", "LinksInCount")
elem = tree.find("//{%s}StatusCode" % api.NS_PREFIXES["alexa"])
assert elem.text == "Success"
我需要进口一些东西吗?我错过了什么。
最佳答案
是的,你需要:import awis