【发布时间】:2015-07-07 19:13:17
【问题描述】:
我正在尝试使用 NOAA 的气候数据在线 REST Web 服务 (http://www.ncdc.noaa.gov/cdo-web/webservices/v2#data) 编写一个 python 程序。但是,我在请求响应中遇到了错误。从命令行尝试使用 curl 请求时,我输入:
curl -H "token:<MYTOKEN>" http://www.ncdc.noaa.gov/cdo-web/api/v2/data?datasetid=GHCND&locationid=ZIP:22405&startdate=1999-10-05&enddate=1999-10-25
它返回这个响应:
[1] 24322
[2] 24323
[3] 24324
phil@philUbu:~$ <?xml version="1.0" encoding="UTF-8" standalone="yes"?><response><statusCode>400</statusCode><userMessage>There was an error with the request.</userMessage><developerMessage>Required parameter 'startdate' is missing.</developerMessage></response>
[1] Done curl -H "token:..." http://www.ncdc.noaa.gov/cdo-web/api/v2/data?datasetid=GHCND
[2]- Done locationid=ZIP:22405
[3]+ Done startdate=1999-10-05
由于某种原因,它认为我错过了开始日期,但我已将其包含在内,并且根据文档的格式正确。有人知道问题可能是什么吗?
【问题讨论】:
标签: python shell rest curl noaa