Skip to content

httr 1.3.0

Compare
Choose a tag to compare
@hadley hadley released this 16 Aug 14:06

API changes

  • Deprecated safe_callback() has been removed.

  • is_interactive argument to init_oauth1.0(), init_oauth2.0() and
    oauth_listener() has been deprecated, as the R session does not actually
    need to be interactive.

New features

  • New set_callback() and get_callback() set and query callback functions
    that are called right before and after performing an HTTP request
    (@gaborcsardi, #409)

  • RETRY() now retries if an error occurs during the request (@asieira, #404),
    and gains two new arguments:

    • terminate_on gives you greater control over which status codes should
      it stop retrying. (@asieira, #404)

    • pause_min allows for sub-second delays. (Use with caution! Generally the
      default is preferred.) (@r2evans)

    • If the server returns HTTP status code 429 and specifies a retry-after
      value, that value will now be used instead of exponential backoff with
      jitter, unless it's smaller than pause_min. (@nielsoledam, #472)

OAuth

  • New oauth cache files are always added to .gitignore and, if it exists,
    .Rbuildignore. Specifically, this now happens when option
    httr_oauth_cache = TRUE or user specifies cache file name explicitly.
    (@jennybc, #436)

  • oauth_encode() now handles UTF-8 characters correctly.
    (@yutannihilation, #424)

  • oauth_app() allows you to specify the redirect_url if you need to
    customise it.

  • oauth_service_token() gains a sub parameter so you can request
    access on behalf of another user (#410), and accepts a character vector
    of scopes as was described in the documentation (#389).

  • oauth_signature() now normalises the URL as described in the OAuth1.0a
    spec (@leeper, #435)

  • New oauth2.0_authorize_url() and oauth2.0_access_token() functions
    pull out parts of the OAuth process for reuse elsewhere (#457).

  • oauth2.0_token() gains three new arguments:

    • config_init allows you to supply additional config for the initial
      request. This is needed for some APIs (e.g. reddit) which rate limit
      based on user_agent (@muschellij2, #363).

    • client_credentials, allows you to use the OAauth2 Client Credential
      Grant
      . See RFC 6749
      for details. (@cderv, #384)

    • A credentials argument that allows you to customise the auth flow.
      For advanced used only (#457)

  • is_interactive argument to init_oauth1.0(), init_oauth2.0() and
    oauth_listener() has been deprecated, as the R session does not need
    to be interactive.

Minor bug fixes and improvements

  • BROWSER() prints a message telling you to browse to the URL if called
    in a non-interactive session.

  • find_cert_bundle() will now correctly find cert bundle in "R_HOME/etc"
    (@jiwalker-usgs, #386).

  • You can now send lists containing curl::form_data() in the body of
    requests with `encoding = "multipart". This makes it possible to specify the
    mime-type of individual components (#430).

  • modify_url() recognised more forms of empty queries. This eliminates a
    source of spurious trailing ? and ?= (@jennybc, #452)

  • More forms of empty query are recognized as such. Eliminates a source of
    spurious trailing ? and ?= in URLs produced by modify_url().
    (@jennybc, #452)

  • The length() method of the internal path class is no longer exported
    (#395).