httr and Accept-Encoding: gzip, deflate

天涯浪子 提交于 2019-12-10 15:19:34

问题


I want to do the following call in R:

curl "http://www.openml.org/api/v1/task/list/limit/3000?api_key=c1994bdb7ecb3c6f3c8f3b35f4b47f1f" -H "Accept-Encoding: gzip, deflate"

The line above returns a gzip compressed string. But when I use the httr R-package it seems that "Accept-Encoding: gzip, deflate" is ignored:

library(httr)
content = GET(url = "http://www.openml.org/api/v1/task/list/limit/3000?api_key=c1994bdb7ecb3c6f3c8f3b35f4b47f1f", add_headers(`Accept-Encoding` = "gzip, deflate"))

回答1:


This issue was discussed and resolved on GitHub:

hadley: I'm pretty sure httr just uncompresses it for you, so you'll need to provide some evidence that the transport itself is not compressed.



来源:https://stackoverflow.com/questions/38592065/httr-and-accept-encoding-gzip-deflate

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!