scrape v3.1.0 Scrape.Source.HTTP

Link to this section Summary

Functions

Perform a HTTP GET request against the given url.

Same as get/1, but will raise if the result is not :ok.

Link to this section Functions

Link to this function

get(url)
get(String.t()) :: {:ok, String.t()} | {:error, any()} | {:http_error, any()}

Perform a HTTP GET request against the given url.

This function is optimized for text-based data, not binary like images. It will try to normalize the response into valid utf-8 and transcode if needed.

Everything that is not a status code 200 with valid encoding will result in some error object.

Examples:

iex> HTTP.get("http://example.com")
{:ok, }"some response"}

Same as get/1, but will raise if the result is not :ok.