如何更改R中发出的http请求中的用户代理字符串?以及如何确定当前的用户代理字符串是什么样的?
提前致谢。
最佳答案
options("HTTPUserAgent")
或getOption("HTTPUserAgent")
显示当前设置,而options(HTTPUserAgent="My settings")
是更改设置的方法。
要临时更改此选项,请使用:withr::with_options
:
withr::with_options(list(HTTPUserAgent="My settings"), download.file(..something..))
或Droplet answer(如果使用download.file
)。
关于url - 在R中的http请求中更改用户代理字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4536835/