ikalnytskyi / httpie-credential-store Goto Github PK
View Code? Open in Web Editor NEWCredential store plugin for HTTPie, attaches auth to ongoing request.
Credential store plugin for HTTPie, attaches auth to ongoing request.
httpie-credential-store current has a dependency on httpie = "^2.0"
. httpie 3 was released in January, which no longer meets this dependency. Additionally, httpie 3 introduced the httpie plugins
command for managing plugins, and attempting to install httpie-credential-store currently results in httpie being forcibly downgraded:
$ httpie plugins install httpie-credential-store
Installing httpie-credential-store...
Collecting httpie-credential-store
Downloading httpie_credential_store-2.0.0-py3-none-any.whl (8.4 kB)
Collecting keyring<22.0,>=21.0
Downloading keyring-21.8.0-py3-none-any.whl (32 kB)
Collecting httpie<3.0,>=2.0
Downloading httpie-2.6.0-py3-none-any.whl (63 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 63.9/63.9 KB 1.4 MB/s eta 0:00:00
Requirement already satisfied: requests[socks]>=2.22.0 in /usr/local/Cellar/httpie/3.1.0/libexec/lib/python3.10/site-packages (from httpie<3.0,>=2.0->httpie-credential-store) (2.27.1)
Requirement already satisfied: setuptools in /usr/local/Cellar/httpie/3.1.0/libexec/lib/python3.10/site-packages (from httpie<3.0,>=2.0->httpie-credential-store) (60.6.0)
Requirement already satisfied: charset-normalizer>=2.0.0 in /usr/local/Cellar/httpie/3.1.0/libexec/lib/python3.10/site-packages (from httpie<3.0,>=2.0->httpie-credential-store) (2.0.12)
Requirement already satisfied: defusedxml>=0.6.0 in /usr/local/Cellar/httpie/3.1.0/libexec/lib/python3.10/site-packages (from httpie<3.0,>=2.0->httpie-credential-store) (0.7.1)
Requirement already satisfied: Pygments>=2.5.2 in /usr/local/Cellar/httpie/3.1.0/libexec/lib/python3.10/site-packages (from httpie<3.0,>=2.0->httpie-credential-store) (2.11.2)
Requirement already satisfied: requests-toolbelt>=0.9.1 in /usr/local/Cellar/httpie/3.1.0/libexec/lib/python3.10/site-packages (from httpie<3.0,>=2.0->httpie-credential-store) (0.9.1)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/Cellar/httpie/3.1.0/libexec/lib/python3.10/site-packages (from requests[socks]>=2.22.0->httpie<3.0,>=2.0->httpie-credential-store) (1.26.8)
Requirement already satisfied: certifi>=2017.4.17 in /usr/local/Cellar/httpie/3.1.0/libexec/lib/python3.10/site-packages (from requests[socks]>=2.22.0->httpie<3.0,>=2.0->httpie-credential-store) (2021.10.8)
Requirement already satisfied: idna<4,>=2.5 in /usr/local/Cellar/httpie/3.1.0/libexec/lib/python3.10/site-packages (from requests[socks]>=2.22.0->httpie<3.0,>=2.0->httpie-credential-store) (3.3)
Requirement already satisfied: PySocks!=1.5.7,>=1.5.6 in /usr/local/Cellar/httpie/3.1.0/libexec/lib/python3.10/site-packages (from requests[socks]>=2.22.0->httpie<3.0,>=2.0->httpie-credential-store) (1.7.1)
Installing collected packages: keyring, httpie, httpie-credential-store
Attempting uninstall: httpie
Found existing installation: httpie 3.1.0
Uninstalling httpie-3.1.0:
Successfully uninstalled httpie-3.1.0
Successfully installed httpie-2.6.0 httpie-credential-store-2.0.0 keyring-21.8.0
Please relax the dependency to httpie = ">=2"
.
Hey having trouble figuring out how to use the shell token provider, not sure what I'm missing
I'd like to use a shell command to grab the token, and apply that as a header value with a custom key. Is that possible?
When user specified wrong keychain provider (due to a typo or not), we need to return a good self-explaining error message, not fail with general KeyError
.
When user specified wrong auth provider (due to a typo or not), we need to return a good self-explaining error message, not fail with general KeyError
.
httpie-credential-store
should provide integration with system keychain/keyring to retrieve secrets from. This can be easily achieved by using nice keyring library available on PyPI.
Because password-store
is a password manager I personally use. Despite being able to easily integrate one using existing shell
keychain provider, using a separate provider for password-store
may help to avoid duplicating hacks such as head -n 1 | tr -d '\n'
all over again and again.
When some http -A creds --debug https://httpbin.org/headers
is ran, HTTPie prints extra context about ongoing request, such as:
>>> requests.request(**{
"allow_redirects": false,
"auth": "<httpie_credential_store._plug.CredentialStoreAuthPlugin.get_auth.<locals>.CredentialStoreAuth object at 0x7f3b27091e20>",
"cert": "None",
"data": {},
"files": {},
"headers": {
"User-Agent": "HTTPie/1.0.3"
},
"method": "get",
"params": {},
"proxies": {},
"stream": true,
"timeout": 30,
"url": "https://httpbin.org/headers",
"verify": true
})
The line
"auth": "<httpie_credential_store._plug.CredentialStoreAuthPlugin.get_auth.<locals>.CredentialStoreAuth object at 0x7f3b27091e20>",
is useless and does not help at all. We need to ensure that we show what auth providers have been used with what credentials (without secrets, of course).
Before using secrets in headers, we need to ensure they do not contain illegal characters such as \n
character. And if they do, return a human readable error about that. Additionally, such check should probably be done for header name of header
auth provider.
README must contain information about
credentials.json
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.