gpt4 book ai didi

python - 类型错误 : 'tuple' object is not callable in python cdsapi

转载 作者:行者123 更新时间:2023-12-04 08:44:02 24 4
gpt4 key购买 nike

我正在尝试借助 python 的 cdsapi 模块检索数据。但正在给出以下错误

    2020-10-19 12:55:52,780 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-press
Traceback (most recent call last):
File "cds.py", line 10, in <module>
}, 'download.grib')
File "build/bdist.linux-x86_64/egg/cdsapi/api.py", line 229, in retrieve
File "build/bdist.linux-x86_64/egg/cdsapi/api.py", line 241, in _api
File "build/bdist.linux-x86_64/egg/cdsapi/api.py", line 358, in wrapped
File "/home/apps/SiteSoftwares/gnu/PYTHONPACKAGES/2.7.9/ucs4/gnu/4.8.5/REQUESTS/2.18.4/lib/python2.7/site-packages/req.4-py2.7.egg/requests/sessions.py", line 555, in post
return self.request('POST', url, data=data, json=json, **kwargs)
File "/home/apps/SiteSoftwares/gnu/PYTHONPACKAGES/2.7.9/ucs4/gnu/4.8.5/REQUESTS/2.18.4/lib/python2.7/site-packages/req.4-py2.7.egg/requests/sessions.py", line 494, in request
prep = self.prepare_request(req)
File "/home/apps/SiteSoftwares/gnu/PYTHONPACKAGES/2.7.9/ucs4/gnu/4.8.5/REQUESTS/2.18.4/lib/python2.7/site-packages/req.4-py2.7.egg/requests/sessions.py", line 437, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/home/apps/SiteSoftwares/gnu/PYTHONPACKAGES/2.7.9/ucs4/gnu/4.8.5/REQUESTS/2.18.4/lib/python2.7/site-packages/req.4-py2.7.egg/requests/models.py", line 309, in prepare
self.prepare_auth(auth, url)
File "/home/apps/SiteSoftwares/gnu/PYTHONPACKAGES/2.7.9/ucs4/gnu/4.8.5/REQUESTS/2.18.4/lib/python2.7/site-packages/req.4-py2.7.egg/requests/models.py", line 540, in prepare_auth
r = auth(self)
TypeError: 'tuple' object is not callable
我已按照以下链接中的建议注册并安装 cdsapi 客户端 key
https://cds.climate.copernicus.eu/api-how-to
我的简单代码片段如下所示
import cdsapi
cds = cdsapi.Client()
cds.retrieve('reanalysis-era5-pressure-levels', {
"variable": "temperature",
"pressure_level": "1000",
"product_type": "reanalysis",
"date": "2017-12-01/2017-12-31",
"time": "12:00",
"format": "grib"
}, 'download.grib')
这有什么问题?

最佳答案

instructions 看不是很明显如果您已登录,但在 key 下您的 .cdsapirc 的字段文件,您需要 两个用户 ID 和 api key 为:

key: $user_id:$api_key
我也遇到了这个问题,并通过包含我的用户 ID 解决了这个问题。

关于python - 类型错误 : 'tuple' object is not callable in python cdsapi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64422955/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com