gpt4 book ai didi

r - 在 R 中使用数据编码 url curl

转载 作者:行者123 更新时间:2023-12-03 22:29:38 26 4
gpt4 key购买 nike

R中的数据编码网址

curl "https://www.zopim.com/api/v2/chats/search" \
-G --data-urlencode "q=timestamp:[2016-02-02T16:00:00 TO *] \
-v -u {email_address}:{password}

如何转换 --data-urlencode这在R?

这是我到目前为止所拥有的:没有搜索部分
  chats <<- getURL('https://www.zopim.com/api/v2/chats/', verbose = TRUE, userpwd = "username:pwd", httpauth = 1L)

在哪里以及如何添加
--data-urlencode "q=timestamp:[2016-02-02T16:00:00 TO *]

在 R ?

最佳答案

library(httr)

GET(
"https://www.zopim.com/api/v2/chats/search",
query=list(
q="timestamp:[2016-02-02T16:00:00 TO *] AND rating:good"
),
authenticate("you@example.com", "yourpassword"),
verbose()
) -> result

content(result, as="parsed")
## $results
## list()
##
## $count
## [1] 0
##
## $prev_url
## NULL
##
## $next_url
## NULL

删除 verbose()在生产中。

关于r - 在 R 中使用数据编码 url curl ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43111715/

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