https://github.com/terrabits/requests-walmart-auth
Python `requests` support for the Walmart Affiliate Marketplace (REST) API required Additional Headers
https://github.com/terrabits/requests-walmart-auth
Last synced: about 1 year ago
JSON representation
Python `requests` support for the Walmart Affiliate Marketplace (REST) API required Additional Headers
- Host: GitHub
- URL: https://github.com/terrabits/requests-walmart-auth
- Owner: Terrabits
- License: mit
- Created: 2022-05-03T17:41:56.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-04T04:06:23.000Z (about 4 years ago)
- Last Synced: 2025-04-19T01:38:27.021Z (about 1 year ago)
- Language: Python
- Size: 14.6 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# requests-walmart-auth
This project provides python `requests` support for the [Walmart Affiliate Marketplace (REST) API](https://walmart.io/docs/affiliate/) required Additional Headers.
## Overview
The Affiliate Marketplace API requires `Additional Headers` to be included in each HTTPS request, as described in the [Onboarding Guide](https://walmart.io/docs/affiliate/onboarding-guide).
This project provides `requests` support for these `Additional Headers` via the `auth` interface.
## Requirements
- Python 3.7+
- pycryptodome ~=3.14.1
- requests ~=2.27.1
## Install
`requests-walmart-auth` can be installed from pypi via pip:
```shell
pip install requests-walmart-auth
```
## Usage
### `WalmartAuth`
The `WalmartAuth` class implements the `requests.auth.AuthBase` interface for use with `requests`.
```python
import requests
from walmart_auth import WalmartAuth
# get auth
auth = WalmartAuth(consumer_id, private_key, key_version, passphrase=None)
# make request with auth
response = requests.get('https://...', auth=auth)
```
### WalmartSession
The `WalmartSession` class implements a persistent `requests.Session` with `WalmartAuth`.
```python
from walmart_auth import WalmartSession
# get session with persistent auth
session = WalmartSession(consumer_id, private_key, key_version, passphrase=None)
# make request; auth is transparent
session.get('https://...')
```
## Command Line Tools
### `walmart-session`
This command line tool creates a new `WalmartSession` and provides a python REPL for experimentation.
From the help menu:
```comment
usage: walmart-session [-h] [--passphrase [PASSPHRASE]]
consumer_id private_key key_version
Start Walmart requests session
positional arguments:
consumer_id
private_key
key_version
options:
-h, --help show this help message and exit
--passphrase [PASSPHRASE], -p [PASSPHRASE]
```