从 ECB 数据仓库中提取数据

Extracting data from the ECB Data Warehouse

我想用 Pandas 提取 this page 中 ECB 数据仓库的给定值。

我一直在经历 ECB help page 但找不到让它工作的方法。

我试过以下代码:

# Building blocks for the URL
entrypoint = 'https://sdw-wsrest.ecb.europa.eu/service/' # Using protocol 'https'
resource = 'data'           
flowRef ='BSI'              
key = 'M.AT.N.A.L20.A.1.U2'    

# Define the parameters
parameters = {
    'startPeriod': '2020-01-01',  # Start date of the time series
    'endPeriod': '2020-12-31'     # End of the time series
}  

request_url = entrypoint + resource + '/'+ flowRef + '/' + key
        
    # Make the HTTP request
    response = requests.get(request_url, params=parameters)
    
    # Check if the response returns succesfully with response code 200
    print(response)
    
    # Print the full URL
    print(response.url)

我一直收到错误代码:

ProxyError: HTTPSConnectionPool - OSError('Tunnel connection failed: 407 Proxy Authentication Required')))

如果有人能帮助我,我将不胜感激。

您需要设置 HTTPS_PROXY 才能退出您的网络:)