我尝试了以下代码(用test.py文件编写):
import pandas as pd
import quandl
d=quandl.get('WIKI/PRICES')
我收到此错误消息:
Traceback (most recent call last):
File "C:\Python36\lib\site-packages\quandl\connection.py", line 55, in parse
return response.json()
File "C:\Python36\lib\site-packages\requests\models.py", line 892, in json
return complexjson.loads(self.text, **kwargs)
File "C:\Python36\lib\json\__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "C:\Python36\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python36\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/L.Shane/Desktop/test.py", line 3, in <module>
d=quandl.get('WIKI/PRICES')
File "C:\Python36\lib\site-packages\quandl\get.py", line 48, in get
data = Dataset(dataset_args['code']).data(params=kwargs, handle_column_not_found=True)
File "C:\Python36\lib\site-packages\quandl\model\dataset.py", line 47, in data
return Data.all(**updated_options)
File "C:\Python36\lib\site-packages\quandl\operations\list.py", line 14, in all
r = Connection.request('get', path, **options)
File "C:\Python36\lib\site-packages\quandl\connection.py", line 36, in request
return cls.execute_request(http_verb, abs_url, **options)
File "C:\Python36\lib\site-packages\quandl\connection.py", line 44, in execute_request
cls.handle_api_error(response)
File "C:\Python36\lib\site-packages\quandl\connection.py", line 61, in handle_api_error
error_body = cls.parse(resp)
File "C:\Python36\lib\site-packages\quandl\connection.py", line 57, in parse
raise QuandlError(http_status=response.status_code, http_body=response.text)
quandl.errors.quandl_error.QuandlError: (Status 403) Something went wrong. Please try again. If you continue to have problems, please contact us at connect@quandl.com.
我怎样才能前进?
更新: 我也在R中尝试过它:
mydata = Quandl("WIKI/PRICES")
现在我收到了这个错误:
Error: <!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en-US"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en-US"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en-US"> <!--<![endif]-->
<head>
<title>Attention Required! | Cloudflare</title>
<meta charset="UTF-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />
<link rel="stylesheet" id="cf_styles-css" href="/cdn-cgi/styles/cf.errors.css" type="text/css" media="screen,projection" />
<!--[if lt IE 9]><link rel="stylesheet" id='cf_styles-ie-css' href="/cdn-cgi/styles/cf.errors.ie.css" type="text/css" media="screen,projection" /><![endif]-->
<style type="text/css">body{margin:0;padd
似乎Cloudflare Captcha正在阻止(我不确定)。
答案 0 :(得分:0)
我相信你需要传递你的身份验证令牌:
quandl.get("EOD/AAPL", authtoken="...")
这将返回Apple(AAPL)的结束日价格。
答案 1 :(得分:0)
如果您没有获取数据,并且在键入quandl.get(“ ...”)时显示错误。然后,您需要转到quandl。在搜索选项中,输入“ GOOGLE STOCK”。然后单击您选择选择的数据集。之后,转到库并单击python,得到类似quandl.get(“ ..... dataset”,authtoken =“ ....”)的内容。复制此代码并将其粘贴到命令外壳中。