View Source ExUrlbox (ExUrlbox v0.1.0)

A light wrapper for the Urlbox API.

Compatible with Urlbox API Version: v1

A list of options that you can pass into ExUrlBox.get/3 can be found here: https://urlbox.io/docs/options

Link to this section Summary

Functions

Build the screenshot request URL

Generates a URL token by taking the HMAC SHA1 of the query string and signing it with your :api_secret.

Send a request to Urlbox for a screenshot. Refer to the official documentation for all the available options: https://urlbox.io/docs/options

Link to this section Functions

@spec build_url(list()) :: String.t()

Build the screenshot request URL

Example URL: /png?url=https%3A%2F%2Fgoogle.com&width=1024&height=768"

Link to this function

generate_url_token(opts)

View Source
@spec generate_url_token(String.t()) :: String.t()

Generates a URL token by taking the HMAC SHA1 of the query string and signing it with your :api_secret.

Example URL Format: https://api.urlbox.io/v1/:api_key/hmac(:api_secret)/format?[options]

Link to this function

get(url, opts \\ [format: "png"], timeout \\ 30000)

View Source
@spec get(String.t(), list(), integer()) :: {:error, any()} | {:ok, Tesla.Env.t()}

Send a request to Urlbox for a screenshot. Refer to the official documentation for all the available options: https://urlbox.io/docs/options

Function signature is: url, [options], timeout

  • Simple example:

      ExUrlbox.get("https://anthonymineo.com")
  • Example with options:

      ExUrlbox.get("https://anthonymineo.com", [format: "png", full_page: true])
  • Example with timeout (5s):

      ExUrlbox.get("https://anthonymineo.com", [], 5_000)