OVH auth plugin for HTTPie.
Project description
Auth plugin for OVH API
Obtain API credentials
You can find URLs to create your application credentials (client id and secret) here: https://github.com/ovh/python-ovh#1-create-an-application
Then, you need to perform a customer key request and validation.
# Replace $OVH_CLIENT_ID with the appropriate value
# Add needed method and path in accessRules list
http -b post https://api.ovh.com/1.0/auth/credential X-Ovh-Application:$OVH_CLIENT_ID accessRules:='[{"method": "GET", "path": "/*"}]'
{
"consumerKey": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"state": "pendingValidation",
"validationUrl": "https://eu.api.ovh.com/auth/?credentialToken=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
Visit validationUrl to validate your consumer key (you need to authenticate
and choose an expiration delay).
Credentials in environment
Plugin can use environement variables OVH_CLIENT_ID, OVH_CLIENT_SECRET and OVH_CONSUMER_KEY to perform httpie authentication.
Rename auth.env.tpl to auth.env and insert your credentials.
Configure your environment before running httpie commands by sourcing this file:
source auth.env
Trigger OVH authentication with --auth-type parameter:
http -b --auth-type ovh https://api.ovh.com/1.0/me
Credentials with -a option
Not yet implemented.
Credentials with configuration file
Not yet implemented.
Interactive credential generation
Not yet implmented.
Implementation
Here is the official API implementation: https://github.com/ovh/python-ovh
OVH API
API documentation available here: https://api.ovh.com/
Development
## install pipenv
# dnf install pipenv or apt install pipenv
## init virtualenv with pipenv
pipenv install --dev
## launch tests in pipenv environment
pytest
## launch tests for all envs
pipenv run tox
Release
Stable branch is master; development branch is dev. Usual release steps are :
# install dev tools and switch in pipenv
pipenv install --dev
pipenv shell
# if needed, update Pipfile.lock and commit changes
pipenv lock --clear
pipenv install --dev
# prepare dev branch for release...
# update version
# increase version; may be launch multiple time to cycle dev, rc, ...
bump2version --verbose prerel [--allow-dirty] [--no-commit] [--no-tag]
# merge on main
git checkout main
git pull
git merge dev
# prepare next development version (+1dev0)
git checkout dev
bump2version --verbose --no-tag minor
# push all (launch with --dry-run to check before actual update)
# delete (git tag -d <tag> unneeded tags - dev, rc)
git push --all
git push --tag
# publish (pypi credentials required)
git checkout tag
pipenv shell
python setup.py clean --all
rm -rf dist/*
python setup.py sdist
python setup.py bdist_wheel
# fake upload
# run pypi-server in another shell
mkdir -p /tmp/packages && pypi-server -P . -a . /tmp/packages/
twine upload -u "" -p "" --repository-url http://localhost:8080/ dist/*.whl dist/*.tar.gz
# real upload
twine upload dist/*.whl dist/*.tar.gz
Changelog
1.1.0 (2022-07-04)
- fix httpie body type (bytes, we need to convert to str)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file httpie-ovh-auth-1.1.0.tar.gz.
File metadata
- Download URL: httpie-ovh-auth-1.1.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44ff7f760ad4e18cbab650d4787e731c6c6733291de3dcce7f377dd54941b790
|
|
| MD5 |
8468513c8fe9d9db68f39c98297a9a52
|
|
| BLAKE2b-256 |
200801c98dfb7d4a3d5e631861996230121ed6e3b813b9d17360de51629442e6
|
File details
Details for the file httpie_ovh_auth-1.1.0-py3-none-any.whl.
File metadata
- Download URL: httpie_ovh_auth-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b29d8b907bb1b2406c38cce9106a427e7cc034bf06934acb7030dc5de007ec84
|
|
| MD5 |
737e66cf35da83bd64bc85d9abf6239c
|
|
| BLAKE2b-256 |
416594b48f6ae697c4c24bd5d5336a4a3db7b4e82d82a45b58b1952f094ea4b2
|