Session Ready
Exercise

Add a custom user agent

Actually, there's also a httpbin.org address that only returns the current user agent (https://httpbin.org/user-agent). You'll use this for the current exercise, where you'll manipulate your own user agent to turn it into something meaningful (for the owners of the website you're scraping, that is).

As you saw in the video, there are two ways of customizing your user agent when using httr for fetching web resources:

  1. Locally, i.e. as an argument to the current request method.
  2. Globally via set_config().
Instructions 1/2
undefined XP
  • 1
  • 2
  • Send a GET request to https://httpbin.org/user-agent with a custom user agent that says "A request from a DataCamp course on scraping" and print the response.
  • In this step, set the user agent locally.