Edgegrid plugin for HTTPie.
Project description
EdgeGrid for HTTPie
EdgeGrid plugin for HTTPie.
This library implements an Authentication handler for HTTP requests using the Akamai EdgeGrid Authentication scheme for HTTPie.
Install
To use the library, you need to have Python 3.9 or later installed on your system.
Then, install the httpie-edgegrid authentication handler from sources by running this command from the project root directory:
pip install .
Alternatively, you can install it from PyPI (Python Package Index) by running:
pip install httpie-edgegrid
Authentication
You can obtain the authentication credentials through an API client. Requests to the API are marked with a timestamp and a signature and are executed immediately.
-
Place your credentials in an EdgeGrid resource file,
.edgerc, under a heading of[default]at your local home directory.[default] client_secret = C113nt53KR3TN6N90yVuAgICxIRwsObLi0E67/N8eRN= host = akab-h05tnam3wl42son7nktnlnnx-kbob3i3v.luna.akamaiapis.net access_token = akab-acc35t0k3nodujqunph3w7hzp7-gtm6ij client_token = akab-c113ntt0k3n4qtari252bfxxbsl-yvsdj -
Use your local
.edgercby providing the path to your resource file and credentials' section header.The
--edgegrid-configargument is optional, as it defaults to~/.edgerc.http --auth-type=edgegrid --edgegrid-config=<path/to/.edgerc> -a <credentials_section_name>: <METHOD> :/<api_endpoint>
Alternatively, you can use an
RC_PATHenvironment variable to point to the.edgercresource file. It's equivalent to the--edgegrid-configargument.export RC_PATH=<path/to/.edgerc>
Use
To use the library, provide your credentials section header and the appropriate endpoint information.
$ http --auth-type=edgegrid -a default: GET :/identity-management/v3/user-profile
Note: You can omit the
METHODargument. If you don't specify it, HTTPie sets it by default to:
GETfor requests without bodyPOSTfor requests with body
For details, see the HTTPie documentation.
Query string parameter
When entering query parameters, pass them as name-value pairs separated with a double equal sign (==).
$ http --auth-type=edgegrid -a default: GET :/identity-management/v3/user-profile \
authGrants==true \
notifications==true \
actions==true
For detail on adding query string parameters, see HTTPie documentation.
Headers
Enter request headers as name-value pairs separated with a colon (:).
Note: You don't need to include the
Content-TypeandContent-Lengthheaders. The authentication layer adds these values.
$ http --auth-type=edgegrid -a default: GET :/identity-management/v3/user-profile \
Accept:application/json
For detail on setting headers, see HTTPie documentation.
Body data
Use the HTTPie syntax to pass simple JSON data in the request.
$ http --auth-type=edgegrid -a default: PUT :/identity-management/v3/user-profile/basic-info \
contractType=Billing \
country=USA \
firstName=John \
lastName=Smith \
phone=3456788765 \
preferredLanguage=English \
sessionTimeOut:=30 \
timeZone=GMT \
Content-Type:application/json \
Accept:application/json
To pass a nested JSON object, see HTTPie documentation for details.
Debug
Use the --verbose argument to enable debugging and get additional information on the HTTP request.
$ http --verbose --auth-type=edgegrid -a default: GET :/identity-management/v3/user-profile
In case of the HTTPie plugin's crash, add the --traceback argument to the request. It prints out the request's detailed stack trace. It's useful for reporting issues.
Run tests in virtual environment
The venv module is included in Python 3 by default.
To test in a virtual environment:
-
Initialize your environment in a new directory.
// Unix/macOS python3 -m venv ~/Desktop/myenv // Windows py -m venv ~/Desktop/myenvThis creates a
venvin the specified directory as well as copies pip into it. -
Activate your environment.
// Unix/macOS source ~/Desktop/myenv/bin/activate // Windows ~/Desktop/myenv/Scripts/activateYour prompt will change to show you're working in a virtual environment, for example:
(myenv) jsmith@abc-de12fg $ -
To recreate the environment, install the required dependencies within your project.
pip install -r dev-requirements.txt -
Run the tests.
// Unix/macOS pytest -v // Windows py -m pytest -v -
To deactivate your environment, run the
deactivatecommand.
Troubleshooting
| Error message | Solution |
|---|---|
http: error: argument --auth-type/-A: invalid choice: 'edgegrid' (choose from 'basic', 'digest') |
macOS Sierra users have reported this error after the package installation. To fix it, try installing the package using pip. |
ImportError: 'pyOpenSSL' module missing required functionality. Try upgrading to v0.14 or newer |
If you get this error, then you're required to install an updated version of pyOpenSSL: $ pip install --ignore-installed pyOpenSSL |
ImportError: No module named cryptography |
Starting with HTTPie v0.9.4, the Mac homebrew package is built with python3. If you get this error, then probably you've installed httpie-edgegrid with python2.7 (unsupported). To explicitly install with python3, run: $ pip3 install . Or: $ pip3 install httpie-edgegrid |
Reporting issues
To report an issue or make a suggestion, create a new GitHub issue.
License
Copyright 2025 Akamai Technologies, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
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 Distributions
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_edgegrid-2.2.3-py3-none-any.whl.
File metadata
- Download URL: httpie_edgegrid-2.2.3-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fff7e8f99ff54c9198b45abc8ce952ca3b5bb3feb3b445bb80c7c71201968a1
|
|
| MD5 |
9e655539cfbf4781398aedcd4573012e
|
|
| BLAKE2b-256 |
0c43ec939ec44815dd1a1419d02009af27ec4ae947ad3bebd33e6ecc5031c995
|