Giter VIP home page Giter VIP logo

Comments (9)

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

@lawinslow, @jiwalker-usgs, or @jread-usgs
I think this is the default using httr, but I'm still on RCurl. Anyone see an easy way to do in in RCurl?

Here's a comparison:

library(httr)
r <- GET("http://nwis.waterservices.usgs.gov/nwis/iv/?site=05114000&format=waterml,1.1&ParameterCd=00060&startDT=2014-10-10&endDT=2014-10-10")
headers(r)

#vs:

library(RCurl)
h <- basicHeaderGatherer()
r2 <- getURI("http://nwis.waterservices.usgs.gov/nwis/iv/?site=05114000&format=waterml,1.1&ParameterCd=00060&startDT=2014-10-10&endDT=2014-10-10", headerfunction = h$update)
h$value()

The headers(r) has"
$content-encoding
[1] "gzip"

The h$value() from r2 doesn't say anything about gzip.

from dataretrieval.

lawinslow avatar lawinslow commented on June 18, 2024

Hmmm. Do you have to specify that you accept gzip in the getURI call?

getURI("http://nwis.waterservices.usgs.gov/nwis/iv/?site=05114000&format=waterml,1.1&ParameterCd=00060&startDT=2014-10-10&endDT=2014-10-10", httpheader=c('Accept-Encoding'='gzip'), headerfunction = h$update)

my initial guess

from dataretrieval.

lawinslow avatar lawinslow commented on June 18, 2024
h$value()
Content-Encoding 
"gzip" 

from dataretrieval.

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

You don't get an error with that getURI request?

Error in curlPerform(curl = curl, .opts = opts, .encoding = .encoding) :
embedded nul in string: '\037<U+008B>\b'

from dataretrieval.

lawinslow avatar lawinslow commented on June 18, 2024

Well WTF, worked for me a second ago

from dataretrieval.

lawinslow avatar lawinslow commented on June 18, 2024
getURI("http://nwis.waterservices.usgs.gov/nwis/iv/?site=05114000&format=waterml,1.1&ParameterCd=00060&startDT=2014-11-11&endDT=2014-11-11", httpheader=c('Accept-Encoding'='gzip'), headerfunction = h$update, encoding='gzip')

from dataretrieval.

lawinslow avatar lawinslow commented on June 18, 2024

@ldecicco-USGS Does this work for you now? (also, slack test)

from dataretrieval.

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

Boom. Works. Now I'll see if it helps or not.

from dataretrieval.

ldecicco-USGS avatar ldecicco-USGS commented on June 18, 2024

It seems like you don't need the httpheader=c('Accept-Encoding'='gzip'), just:

getURI(url, 
              headerfunction = h$update, 
               encoding='gzip')

And it is a tad faster. Nice.

from dataretrieval.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.