0

我正在使用 Alpha Vantage API 和 python。我能够在我的机器上成功安装 alpha vantage。不幸的是,我在必须定义代理的公司环境中工作。所以这行代码对我来说非常好:

from alpha_vantage.timeseries import TimesSeries

但是这行代码不起作用:

data, meta_data = ts.get_intraday('GOOGL')

错误日志中的最后一条错误消息是:

URLError: <urlopen error [WinError 10061] No connection could be made because the target machine actively refused it>

我想我必须定义代理(使用凭据),但我不知道 Alpha Vantage API 在哪里以及如何使用。

4

1 回答 1

1

您可以使用指定代理

proxies = {
    'http': 'http://user:pass@10.10.1.0:3128',
    'https': 'http://user:pass@10.10.1.0:3128',
}

ts = TimeSeries(key='your_key')

ts.set_proxy(proxies)
于 2018-09-11T20:20:22.753 回答