Astra plugin for HTTPie.
Project description
Astra plugin for HTTPie.
Installation
To install from sources:
$ python setup.py install
If using python 3 on Mac, replace python with python3:
$ python3 setup.py install
Or, if you like, you can just use pip:
$ pip install httpie-astra
Usage
The Astra plugin relies on a .astrarc credentials file that will be created in your home directory and organized by [section] following the format below. Each [section] can contain a different credentials set allowing you to store all of your credentials in a single file.
[default]
ASTRA_DB_REGION = *******
ASTRA_DB_ID = *********************
ASTRA_DB_USERNAME = *********
ASTRA_DB_PASSWORD = *********
ASTRA_DB_KEYBASE = tutorial
ASTRA_DB_TOKEN = xxxx
ASTRA_DB_TOKEN_TIME = X
[section1]
ASTRA_DB_REGION = *******
ASTRA_DB_ID = *********************
ASTRA_DB_USERNAME = *********
ASTRA_DB_PASSWORD = *********
ASTRA_DB_KEYBASE = tutorial
ASTRA_DB_TOKEN = xxxx
ASTRA_DB_TOKEN_TIME = X
Once you have the credentials set up, here is an example of what an Astra Call call would look like:
% http --auth-type astra -a default: :/rest/v2/schemas/keyspaces
or
% http :/graphql/tutorial query='query { products(value: { id: "65cad0df-4fc8-42df-90e5-4effcd221ef7" }) { values { id name description price created } } }'
When you run the command, if your authentication token has expired it will refresh it for you.
I have made a change to how httpie processes json data. To pass JSON in the request, just use something like this:
http --auth-type astra -a default: POST :/rest/v2/schemas/keyspaces/KS/tables \
json:='{"name":"products","ifNotExists":true,"columnDefinitions": [\
{"name":"id","typeDefinition":"uuid","static":false}, {"name":"name","typeDefinition":"text","static":false}, \
{"name":"description","typeDefinition":"text","static":false}, {"name":"price","typeDefinition":"decimal","static":false}, \
{"name":"created","typeDefinition":"timestamp","static":false}],"primaryKey": {"partitionKey":["id"]},"tableOptions":{"defaultTimeToLive":0}}'
Note that you can create a configuration file to simplify the command further
File: ~/.config/httpie/config.json
{
"default_options": [
"--style=fruity",
"--auth-type=astra",
"--auth=default:"
]
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for httpie_astra-0.0.13-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4573b45e1756659d0bf091781a2ba37d0d0f79b690d3ad867542e50c4ee5329e |
|
MD5 | 61463ba55ce91e9ec89f37de3f05d942 |
|
BLAKE2b-256 | ad8b444fd5cc4589bfcbdd5c385f97e987a936e1a3d0be6fbb9730917d74c99c |
Hashes for httpie_astra-0.0.13-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b8abd0b4465899de5d810611dfabf0f263b2e74abbb8d0ed6cd8a510e9fe880 |
|
MD5 | 9d0e8674b635dd42a0d341915c8fc22d |
|
BLAKE2b-256 | 9c3007cc151480d3fb01de59c2ea80da282f9a373c63814a7ffd70005f3c9c9a |