gpt4 book ai didi

api - 如何使用 Unfuddle API 获取文件?

转载 作者:塔克拉玛干 更新时间:2023-11-01 19:11:40 26 4
gpt4 key购买 nike

正如您即将看到的那样,我是网络编程的新手。

我正在尝试使用 Unfuddle 的 API 定期检索文件。我尝试了他们的第一个代码示例,它似乎从我的 HTTP GET 调用返回了有效信息,但我不知道如何使用此信息将特定文件放到我的硬盘上。这是怎么做到的?

这是我的确切 HTTP GET 调用和响应(除了被替换的密码):

bmihura@bmihura-PC ~
$ curl -i -u bmihra:password -X GET \
> -H 'Accept: application/xml' \
> 'http://spowertech.unfuddle.com/api/v1/projects/projects.xml'
HTTP/1.1 302 Found
Server: nginx/1.0.5
Date: Fri, 17 Aug 2012 11:53:23 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.8
Vary: Accept-Encoding
Cache-Control: no-cache
Set-Cookie: authenticated=; domain=.unfuddle.com; path=/; expires=Thu, 01-Jan-19 70 00:00:00 GMT
Set-Cookie: authenticated=false; path=/; expires=Fri, 17-Aug-2012 13:51:24 GMT
Set-Cookie: unfuddle_secure=; domain=.unfuddle.com; path=/; expires=Thu, 01-Jan- 1970 00:00:00 GMT
Set-Cookie: _unfuddle_session=; domain=.unfuddle.com; path=/; expires=Thu, 01-Ja n-1970 00:00:00 GMT
Set-Cookie: _unfuddle_session=BAh7BjoPc2Vzc2lvbl9pZCIlZGIzOTlmMTcxZGIwZjE4MDRhZW RkZGVmOGI4YjIxNzM%3D--0833ed386e5cd62894bb8dd787d856545897df35; path=/; expires= Fri, 17-Aug-2012 13:53:24 GMT; HttpOnly
Location: https://spowertech.unfuddle.com/projects/projects
Content-Length: 115
Status: 302

<html><body>You are being <a href="https://spowertech.unfuddle.com/projects/proj ects">redirected</a>.</body></html>

最佳答案

您需要在底部的 url 中使用 https 而不是 http - 即

curl -i -u bmihra:password -X GET \
-H 'Accept: application/xml' \
'https://spowertech.unfuddle.com/api/v1/projects/projects.xml'

此外,为了让它在我的 Windows 机器上运行,我必须将 -H 中的 ' 替换为 "并删除 url 周围的 '。所以我最终使用了

curl -i -u bmihra:password -X GET \
-H "Accept: application/xml" \
https://spowertech.unfuddle.com/api/v1/projects/projects.xml

希望对您有所帮助!

关于api - 如何使用 Unfuddle API 获取文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12005654/

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