Giter VIP home page Giter VIP logo

zenrows's Introduction

Zenrows

ZenRows is an Elixir client library for interacting with the ZenRows API. It provides a simple and convenient way to send HTTP requests to the ZenRows API, allowing you to scrape web pages and extract data easily.

View the documentation.

Installation

Add zenrows to your list of dependencies in mix.exs:

def deps do
  [
    {:zenrows, "~> 0.1"}
  ]
end

Then run mix deps.get to install the dependency.

Configuration

Configure the zenrows library by adding the following to your config.exs file:

config :zenrows,
  api_key: "YOUR_API_KEY",
  adapter: Tesla.Adapter.Hackney,
  retries: 3,
  delay: 1000,
  max_delay: 10_000,
  timeout: 30_000
  • api_key (required): Your ZenRows API key. Get your free API key from the ZenRows dashboard.
  • adapter (optional): The HTTP adapter module to use for requests. Default is Tesla.Adapter.Hackney.
  • retries (optional): The number of times to retry failed requests. Default is 0.
  • delay (optional): The initial delay in milliseconds between retries. Default is 500.
  • max_delay (optional): The maximum delay in milliseconds between retries. Default is 4000.
  • timeout (optional): The request timeout in milliseconds. Default is 30000.

Usage

Making GET requests

ZenRows.get("https://example.com", headers: %{"Authorization" => "Bearer token"}, config: %ZenRows.Config{js_render: true})

Making POST requests

ZenRows.post("https://example.com", data: %{key: "value"}, headers: %{"Authorization" => "Bearer token"})

Request Options

  • :headers (optional): A map of additional headers to include in the request. Default is an empty map.
  • :config (optional): A ZenRows.Config struct specifying the configuration options for the request. Default is an empty struct.
  • :data (optional): A map of data to be sent as the request body in a POST request. Default is an empty map.
  • :adapter (optional): The HTTP adapter module to use for the request. Default is Tesla.Adapter.Hackney.
  • :retries (optional): The number of times to retry failed requests. Overrides the application environment configuration.
  • :delay (optional): The initial delay in milliseconds between retries. Overrides the application environment configuration.
  • :max_delay (optional): The maximum delay in milliseconds between retries. Overrides the application environment configuration.
  • :timeout (optional): The request timeout in milliseconds. Overrides the application environment configuration.

For more information on the available configuration options, refer to the ZenRows.Config documentation.

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

License

ZenRows is released under the MIT License. See the LICENSE file for more information.

zenrows's People

Contributors

guess avatar

Stargazers

Néstor avatar

Watchers

 avatar

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.