-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DXE-4311 Merge pull request #79 from akamai/release/v2.2.0
Release/v2.2.0
- Loading branch information
Showing
19 changed files
with
560 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,59 @@ | ||
# HTTPIE EDGEGRID RELEASE NOTES | ||
# RELEASE NOTES | ||
|
||
## 2.1.4 (2024-06-06) | ||
## 2.2.0 (Dec 9, 2024) | ||
|
||
### Enhancements | ||
### FEATURES/ENHANCEMENTS: | ||
|
||
* Updated `pyOpenSSL`, `pylint` and test dependencies | ||
* Discontinued support for Python <= 3.8; Python 3.9 is now the minimum supported version. | ||
* Updated several dependencies in `setup.py`. | ||
* Started generating the `requirements.txt` and `dev-requirements.txt` files using `pip-compile`, | ||
so that they contain the full set of project dependencies. | ||
|
||
## 2.1.3 (2023-09-14) | ||
### BUG FIXES: | ||
|
||
### Enhancements | ||
* Fixed installation failure with HTTPie CLI ([I#76](https://github.com/akamai/httpie-edgegrid/issues/76)). | ||
|
||
* Update `urllib3` and test dependencies | ||
## 2.1.4 (Jun 6, 2024) | ||
|
||
## 2.1.2 (2023-06-22) | ||
### FEATURES/ENHANCEMENTS: | ||
|
||
### Bug fixes | ||
* Updated the `pyOpenSSL`, `pylint`, and test dependencies. | ||
|
||
* Fix bug returning unexpected error when performing basic API call ([I#34](https://github.com/akamai/httpie-edgegrid/issues/34)) | ||
## 2.1.3 (Sep 14, 2023) | ||
|
||
### Enhancements | ||
### FEATURES/ENHANCEMENTS: | ||
|
||
* Update `httpie` and `pyOpenSSL` dependencies | ||
* Updated the `urllib3` and test dependencies. | ||
|
||
## 2.1.1 (2022-09-27) | ||
## 2.1.2 (Jun 22, 2023) | ||
|
||
### Enhancements | ||
### FEATURES/ENHANCEMENTS: | ||
|
||
* Update edgegrid-python dependency | ||
* Updated the `httpie` and `pyOpenSSL` dependencies. | ||
|
||
## 2.1.0 (2022-08-30) | ||
### BUG FIXES: | ||
|
||
### Enhancements | ||
* Fixed a bug related to returning an unexpected error when performing a basic API call ([I#34](https://github.com/akamai/httpie-edgegrid/issues/34)). | ||
|
||
* Update edgegrid-python dependency | ||
## 2.1.1 (Sep 27, 2022) | ||
|
||
## 2.0.0 (2022-04-27) | ||
### FEATURES/ENHANCEMENTS: | ||
|
||
### BREAKING CHANGES | ||
* Updated the `edgegrid-python` dependency. | ||
|
||
* Dropped Python 2.7 support | ||
## 2.1.0 (Aug 30, 2022) | ||
|
||
### Enhancements | ||
### FEATURES/ENHANCEMENTS: | ||
|
||
* New optional parameter: `--edgegrid-config`, the path for the `.edgerc` credentials file. It defaults to `~/.edgerc` | ||
* New `RC_PATH` environment variable, equivalent to the `--edgegrid-config` parameter | ||
* Updated the `edgegrid-python` dependency. | ||
|
||
## 2.0.0 (Jul 22, 2022) | ||
|
||
### BREAKING CHANGES: | ||
|
||
* Dropped Python 2.7 support. | ||
|
||
### FEATURES/ENHANCEMENTS: | ||
|
||
* Added the new optional `--edgegrid-config` parameter for providing a path for the `.edgerc` credentials file. It defaults to `~/.edgerc`. | ||
* Added the new `RC_PATH` environment variable, equivalent to the `--edgegrid-config` parameter. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,194 @@ | ||
# httpie-edgegrid | ||
# EdgeGrid for HTTPie | ||
|
||
EdgeGrid plugin for [HTTPie](https://github.com/jkbr/httpie). | ||
|
||
## Installation | ||
This library implements an Authentication handler for HTTP requests using the [Akamai EdgeGrid Authentication](https://techdocs.akamai.com/developer/docs/authenticate-with-edgegrid) scheme for HTTPie. | ||
|
||
To install from sources: | ||
## Install | ||
|
||
``` bash | ||
$ python setup.py install | ||
``` | ||
To use the library, you need to have Python 3.9 or later installed on your system. | ||
|
||
When using python 3 on Mac, replace python with python3: | ||
Then, install the `httpie-edgegrid` authentication handler from sources by running this command from the project root directory: | ||
|
||
``` bash | ||
$ python3 setup.py install | ||
``` | ||
``` | ||
pip install . | ||
``` | ||
|
||
If you have problems installing from sources, you could use pip: | ||
Alternatively, you can install it from PyPI (Python Package Index) by running: | ||
|
||
``` bash | ||
$ pip install httpie-edgegrid | ||
``` | ||
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. | ||
|
||
1. [Create authentication credentials](https://techdocs.akamai.com/developer/docs/set-up-authentication-credentials). | ||
|
||
2. 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 | ||
``` | ||
3. Use your local `.edgerc` by providing the path to your resource file and credentials' section header. | ||
The `--edgegrid-config` argument is optional, as it defaults to `~/.edgerc`. | ||
## Running tests in virtual environment | ||
```bash | ||
http --auth-type=edgegrid --edgegrid-config=<path/to/.edgerc> -a <credentials_section_name>: <METHOD> :/<api_endpoint> | ||
``` | ||
To test in a [virtual | ||
environment](https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments), | ||
run: | ||
Alternatively, you can use an `RC_PATH` environment variable to point to the `.edgerc` resource file. It's equivalent to the `--edgegrid-config` argument. | ||
``` bash | ||
$ python3 -m venv venv | ||
$ . venv/bin/activate | ||
$ pip install -r requirements_dev.txt | ||
$ python -m unittest discover | ||
```bash | ||
export RC_PATH=<path/to/.edgerc> | ||
``` | ||
|
||
## Use | ||
|
||
To use the library, provide your credentials section header and the appropriate endpoint information. | ||
|
||
```bash | ||
$ http --auth-type=edgegrid -a default: GET :/identity-management/v3/user-profile | ||
``` | ||
> **Note:** You can omit the `METHOD` argument. If you don't specify it, HTTPie sets it by default to: | ||
> | ||
> - `GET` for requests without body | ||
> - `POST` for requests with body | ||
## Usage | ||
For details, see the [HTTPie documentation](https://httpie.io/docs/cli/optional-get-and-post). | ||
|
||
The EdgeGrid plugin relies on a .edgerc credentials file that needs to 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 .edgerc file. | ||
### Query string parameter | ||
|
||
When entering query parameters, pass them as name-value pairs separated with a double equal sign (`==`). | ||
|
||
```bash | ||
$ http --auth-type=edgegrid -a default: GET :/identity-management/v3/user-profile \ | ||
authGrants==true \ | ||
notifications==true \ | ||
actions==true | ||
``` | ||
[default] | ||
client_secret = xxxx | ||
host = xxxx # Note, don't include the https:// here | ||
access_token = xxxx | ||
client_token = xxxx | ||
max-body = xxxx | ||
[section1] | ||
client_secret = xxxx | ||
host = xxxx # Note, don't include the https:// here | ||
access_token = xxxx | ||
client_token = xxxx | ||
max-body = xxxx | ||
|
||
For detail on adding query string parameters, see [HTTPie documentation](https://httpie.io/docs/cli/querystring-parameters). | ||
|
||
|
||
### Headers | ||
|
||
Enter request headers as name-value pairs separated with a colon (`:`). | ||
|
||
> **Note:** You don't need to include the `Content-Type` and `Content-Length` headers. The authentication layer adds these values. | ||
```bash | ||
$ http --auth-type=edgegrid -a default: GET :/identity-management/v3/user-profile \ | ||
Accept:application/json | ||
``` | ||
|
||
Once you have the credentials set up, here is an example of what an Akamai OPEN API call would look like: | ||
For detail on setting headers, see [HTTPie documentation](https://httpie.io/docs/cli/http-headers). | ||
|
||
``` bash | ||
% http --auth-type edgegrid -a <section_name>: :/<api_endpoint> | ||
### Body data | ||
|
||
Use the [HTTPie syntax](https://httpie.io/docs/cli/non-string-json-fields) to pass simple JSON data in the request. | ||
|
||
```bash | ||
$ 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 | ||
``` | ||
|
||
### Example | ||
To pass a nested JSON object, see [HTTPie documentation](https://httpie.io/docs/cli/nested-json) for details. | ||
|
||
### Debug | ||
|
||
Making the diagnostic-tools API [locations]{.title-ref} call: | ||
Use the `--verbose` argument to enable debugging and get additional information on the HTTP request. | ||
|
||
``` bash | ||
% http --auth-type edgegrid -a default: :/edge-diagnostics/v1/edge-locations | ||
``` | ||
$ http --verbose --auth-type=edgegrid -a default: GET :/identity-management/v3/user-profile | ||
``` | ||
|
||
## Parameters | ||
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](#reporting-issues). | ||
|
||
`--edgegrid-config` | ||
## Run tests in virtual environment | ||
|
||
Path to `.edgerc` credentials file (optional, defaults to `~/.edgerc`) | ||
The `venv` module is included in Python 3 by default. | ||
|
||
## Environment variables | ||
To test in a [virtual environment](https://docs.python.org/3/library/venv.html): | ||
|
||
`RC_PATH` | ||
1. Initialize your environment in a new directory. | ||
|
||
Path to `.edgerc` credentials file (optional, equivalent to the `--edgegrid-config` parameter) | ||
``` | ||
// Unix/macOS | ||
python3 -m venv ~/Desktop/myenv | ||
## Troubleshooting | ||
// Windows | ||
py -m venv ~/Desktop/myenv | ||
``` | ||
|
||
MacOS Sierra users have reported the error \"http: error: argument \--auth-type/-A: invalid choice: \'edgegrid\' (choose from \'basic\', \'digest\')\" after installation. Try installing using pip instead. | ||
This creates a `venv` in the specified directory as well as copies pip into it. | ||
|
||
The error \"ImportError: 'pyOpenSSL' module missing required functionality. Try upgrading to v0.14 or newer\" requires you to install an updated version of \`pyOpenSSL\`: | ||
2. Activate your environment. | ||
|
||
``` bash | ||
$ pip install --ignore-installed pyOpenSSL | ||
``` | ||
``` | ||
// Unix/macOS | ||
source ~/Desktop/myenv/bin/activate | ||
Since v0.9.4 of httpie the Mac homebrew package is build with python3. If you get an error for \"ImportError: No module named cryptography\" then probably you installed httpie-edgegrid with python2.7 (unsupported). To explicitly install with python3 use: | ||
// Windows | ||
~/Desktop/myenv/Scripts/activate | ||
``` | ||
|
||
``` bash | ||
$ sudo python3 setup.py install | ||
``` | ||
Your prompt will change to show you're working in a virtual environment, for example: | ||
|
||
Or with pip3: | ||
``` | ||
(myenv) jsmith@abc-de12fg $ | ||
``` | ||
|
||
``` bash | ||
$ sudo pip3 install httpie-edgegrid | ||
``` | ||
3. To recreate the environment, install the required dependencies within your project. | ||
|
||
``` | ||
pip install -r dev-requirements.txt | ||
``` | ||
|
||
4. Run the tests. | ||
|
||
``` | ||
// Unix/macOS | ||
pytest -v | ||
// Windows | ||
py -m pytest -v | ||
``` | ||
|
||
5. To deactivate your environment, run the `deactivate` command. | ||
|
||
## 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`: <br /> <br /> `$ 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: <br /> <br /> `$ pip3 install .` <br /> <br /> Or: <br /> <br /> `$ pip3 install httpie-edgegrid` | | ||
|
||
## Reporting issues | ||
|
||
To report an issue or make a suggestion, create a new [GitHub issue](https://github.com/akamai/httpie-edgegrid/issues). | ||
|
||
## License | ||
|
||
Copyright 2024 Akamai Technologies, Inc. All rights reserved. | ||
|
||
## Advisories | ||
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. | ||
|
||
Starting with HTTPie version 2.3.0 uploads are streamed, causing an issue posting JSON payloads as those don\'t include a content-length causing an error with the [Edgegrid authentication libraries](https://github.com/akamai/AkamaiOPEN-edgegrid-python). See [Issue #49](https://github.com/akamai/AkamaiOPEN-edgegrid-python/issues/49) for more details | ||
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. |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM python:3-alpine3.19 | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# https://github.com/pyenv/pyenv/wiki#suggested-build-environment | ||
RUN apk add --no-cache git bash build-base libffi-dev openssl-dev bzip2-dev zlib-dev xz-dev readline-dev sqlite-dev tk-dev | ||
RUN apk add --no-cache curl | ||
RUN curl https://pyenv.run | bash | ||
ENV PYENV_ROOT="/root/.pyenv" | ||
ENV PATH="$PYENV_ROOT/bin:$PATH" | ||
RUN pyenv install 3.9 3.10 3.11 3.12 3.13 | ||
RUN echo 'eval "$(pyenv init -)"' >> ~/.profile | ||
|
||
RUN pip install --no-cache-dir tox |
Oops, something went wrong.