问题描述
以下httr POST命令出现问题
try(POST("https://marketsgateway.pjm.com/marketsgateway/xml/query",add_headers(.headers = headers),body=uptoXML,verbose()),silent=FALSE)
它返回此消息:
Error in curl::curl_fetch_memory(url,handle = handle) :
transfer closed with outstanding read data remaining
似乎我需要以某种方式更改POST设置以获取所有数据。当请求的是较小的数据集时,它可以正常工作。但是,当它稍大一些时,我会收到此内存错误。我已经搜索了R解决方案,但是找不到如何修改POST默认值来获取所有数据块的方法。
以下是详细输出(更改了敏感的cookie数据):
-> POST /marketsgateway/xml/query HTTP/1.1
-> User-Agent: libcurl/7.35.0 r-curl/3.2 httr/1.4.2
-> Host: marketsgateway.pjm.com
-> Accept-Encoding: gzip,deflate
-> Accept: application/json,text/xml,application/xml,*/*
-> Cookie: xxxxxxxxx
-> Content-Type: text/xml
-> Content-Length: 289
->
>> <?xml version="1.0"?>
>> <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
>> <Header/>
>> <Body>
>> <QueryRequest xmlns="http://emkt.pjm.com/emkt/xml">
>> <QueryUpToTransactionResults day="2020-08-09"/>
>> </QueryRequest>
>> </Body>
>> </Envelope>
<- HTTP/1.1 302 Found
<- Connection: keep-alive
<- Location: https://sso.pjm.com/access/UI/Login?goto=https%3A%2F%2Fmarketsgateway.pjm.com%3A443%2Fmarketsgateway%2Fxml%2Fquery
<- Content-Length: 0
<- Date: Tue,11 Aug 2020 00:10:57 GMT
<- Set-Cookie: MARKETSGATEWAY=xxxxxxxxx;Path=/;Version=1;Secure;Httponly
<-
-> GET /access/UI/Login?goto=https%3A%2F%2Fmarketsgateway.pjm.com%3A443%2Fmarketsgateway%2Fxml%2Fquery HTTP/1.1
-> User-Agent: libcurl/7.35.0 r-curl/3.2 httr/1.4.2
-> Host: sso.pjm.com
-> Accept-Encoding: gzip,*/*
-> Cookie: xxxxxxxxxxx
-> Content-Type: text/xml
-> Content-Length: 289
->
<- HTTP/1.1 302
<- Date: Tue,11 Aug 2020 00:10:57 GMT
<- Location: /access/XUI/?goto=https://marketsgateway.pjm.com:443/marketsgateway/xml/query#login/
<- X-Frame-Options: ALLOW-FROM https://esuite.pjm.com
<- Content-Length: 0
<- Set-Cookie: SSO=xxxxxxxxxxxx; path=/; Httponly; Secure
<- Connection: close
<- Set-Cookie: AMDistAuthCookie=https://sso.pjm.com:443/das/UI/Login
<-
-> GET /access/XUI/?goto=https://marketsgateway.pjm.com:443/marketsgateway/xml/query HTTP/1.1
-> User-Agent: libcurl/7.35.0 r-curl/3.2 httr/1.4.2
-> Host: sso.pjm.com
-> Accept-Encoding: gzip,deflate
-> Cookie: SSO=xxxxxxxxxx
-> Accept: application/json,*/*
-> Cookie: xxxxxxxxxxx
-> Content-Type: text/xml
-> Content-Length: 289
->
<- HTTP/1.1 200
<- Accept-Ranges: bytes
<- Cache-Control: public,max-age=300
<- Date: Tue,11 Aug 2020 00:10:57 GMT
<- ETag: W/"1410-1577378972000"
<- Last-Modified: Thu,26 Dec 2019 16:49:32 GMT
<- X-Frame-Options: ALLOW-FROM https://esuite.pjm.com
<- Content-Type: text/html
<- Connection: close
<- Location:
<- Set-Cookie: AMDistAuthCookie=https://sso.pjm.com:443/das/UI/Login
<- Transfer-Encoding: chunked
<-
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)