Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nithinbekal/amazon_books
Fetch book information from Amazon API
https://github.com/nithinbekal/amazon_books
amazon-api amazon-books elixir elixir-lang
Last synced: 11 days ago
JSON representation
Fetch book information from Amazon API
- Host: GitHub
- URL: https://github.com/nithinbekal/amazon_books
- Owner: nithinbekal
- Created: 2016-11-22T09:20:46.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-16T04:50:51.000Z (almost 6 years ago)
- Last Synced: 2024-10-11T01:49:01.734Z (28 days ago)
- Topics: amazon-api, amazon-books, elixir, elixir-lang
- Language: Elixir
- Size: 17.6 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Amazon Books API
Provides functions to fetch book information from Amazon Products API.
## Usage
Add `amazon_books` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[{:amazon_books, "~> 0.4.0"}]
end
```Configure your AWS credentials like this:
```elixir
config :amazon_books, :associate_tag, "associate-tag"
config :amazon_books, :access_key_id, "your-access-key"
config :amazon_books, :secret_access_key, "your-key"
```In production, you might want to load your config from environment variables.
For this, you can use the following syntax:```elixir
config :amazon_books,
associate_tag: {:system, "AMAZON_ASSOCIATE_TAG"},
access_key_id: {:system, "AMAZON_ACCESS_KEY_ID"},
secret_access_key: {:system, "AMAZON_SECRET_ACCESS_KEY"}
```Examples:
```elixir
# Lookup by ISBN 10 or ASIN
AmazonBooks.lookup("076243631X")# Search by title or keywords
AmazonBooks.search_by_title("Elixir in Action")
AmazonBooks.search_by_keywords("elixir programming")# Search within a country (defaults to US)
AmazonBooks.search_by_title("Elixir in Action", %{"country" => "IN"})# Include additional options
AmazonBooks.lookup("076243631X", %{"Sort" => "relevancerank"})# Perform custom queries
AmazonBooks.query(%{"Title" => "Harry Potter", "Sort" => "relevancerank"})
```