edgegrid-python 2.0.5__tar.gz → 2.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {edgegrid_python-2.0.5/edgegrid_python.egg-info → edgegrid_python-2.0.6}/PKG-INFO +1 -1
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/__init__.py +1 -1
- edgegrid_python-2.0.6/ci/check_namespace_pkg.py +33 -0
- edgegrid_python-2.0.6/ci/coverage_report.py +71 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6/edgegrid_python.egg-info}/PKG-INFO +1 -1
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/edgegrid_python.egg-info/SOURCES.txt +7 -3
- edgegrid_python-2.0.6/edgegrid_python.egg-info/top_level.txt +4 -0
- edgegrid_python-2.0.6/examples/create-credentials.py +34 -0
- edgegrid_python-2.0.6/examples/delete-credentials.py +35 -0
- edgegrid_python-2.0.6/examples/get-credentials.py +37 -0
- edgegrid_python-2.0.6/examples/update-credentials.py +47 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/requirements.txt +1 -1
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/setup.py +4 -4
- edgegrid_python-2.0.5/akamai/__init__.py +0 -2
- edgegrid_python-2.0.5/edgegrid_python.egg-info/namespace_packages.txt +0 -1
- edgegrid_python-2.0.5/edgegrid_python.egg-info/top_level.txt +0 -1
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/LICENSE +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/MANIFEST.in +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/README.md +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/edgegrid.py +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/edgerc.py +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/test/__init__.py +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/test/conftest.py +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/test/edgerc_that_doesnt_parse +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/test/sample_edgerc +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/test/sample_file.txt +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/test/test_edgegrid.py +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/test/testcases.json +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/test/testdata.json +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/edgegrid_python.egg-info/dependency_links.txt +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/edgegrid_python.egg-info/requires.txt +0 -0
- {edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/setup.cfg +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Namespace package import test — run by ci/test_namespace_pkg.sh after both
|
|
3
|
+
edgegrid-python and the temporary akamai-dummy fragment are installed.
|
|
4
|
+
Requires REPO_DIR env var pointing to the edgegrid-python repo root.
|
|
5
|
+
"""
|
|
6
|
+
import akamai
|
|
7
|
+
import akamai.dummy
|
|
8
|
+
import akamai.edgegrid
|
|
9
|
+
import os
|
|
10
|
+
|
|
11
|
+
from akamai.dummy import SENTINEL
|
|
12
|
+
from akamai.edgegrid import EdgeGridAuth, EdgeRc
|
|
13
|
+
|
|
14
|
+
assert SENTINEL == "akamai.dummy is here", f"Unexpected value: {SENTINEL!r}"
|
|
15
|
+
|
|
16
|
+
# Exercise real EdgeRc code — parse the sample_edgerc shipped with the package.
|
|
17
|
+
sample_edgerc = os.path.join(os.environ["REPO_DIR"], "akamai", "edgegrid", "test", "sample_edgerc")
|
|
18
|
+
rc = EdgeRc(sample_edgerc)
|
|
19
|
+
assert rc.get("default", "host") == "xxxx-xxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxx.luna.akamaiapis.net/", "EdgeRc.get failed"
|
|
20
|
+
|
|
21
|
+
# Both fragments must live under the *same* namespace package object.
|
|
22
|
+
# Each entry in akamai.__path__ is the `akamai/` dir from one fragment.
|
|
23
|
+
# Derive expected dirs by going up one level from each sub-package's __file__.
|
|
24
|
+
real_paths = [os.path.realpath(p) for p in akamai.__path__ if os.path.isdir(p)]
|
|
25
|
+
|
|
26
|
+
edgegrid_frag = os.path.realpath(os.path.join(os.path.dirname(akamai.edgegrid.__file__), ".."))
|
|
27
|
+
dummy_frag = os.path.realpath(os.path.join(os.path.dirname(akamai.dummy.__file__), ".."))
|
|
28
|
+
|
|
29
|
+
assert edgegrid_frag in real_paths, f"edgegrid fragment {edgegrid_frag!r} not in {real_paths}"
|
|
30
|
+
assert dummy_frag in real_paths, f"dummy fragment {dummy_frag!r} not in {real_paths}"
|
|
31
|
+
|
|
32
|
+
print(f"OK — akamai.edgegrid is reachable from {edgegrid_frag}")
|
|
33
|
+
print(f"OK — akamai.dummy is reachable from {dummy_frag}")
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Generate a coverage summary markdown table from Cobertura XML files.
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
python ci/coverage_report.py <version>:<path/to/cobertura.xml> ...
|
|
6
|
+
|
|
7
|
+
Each positional argument is a colon-separated pair of a label (e.g. the
|
|
8
|
+
Python version) and the path to a Cobertura-format XML coverage report.
|
|
9
|
+
The script reads the top-level ``line-rate`` attribute from each file,
|
|
10
|
+
formats it as a percentage, and prints a markdown table to stdout.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import argparse
|
|
14
|
+
import sys
|
|
15
|
+
import xml.etree.ElementTree as ET
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def parse_line_coverage(xml_path: str) -> float:
|
|
19
|
+
"""Return the top-level line coverage rate (0–1) from a Cobertura XML file."""
|
|
20
|
+
try:
|
|
21
|
+
tree = ET.parse(xml_path) # noqa: S314 — file is a trusted CI artifact
|
|
22
|
+
except ET.ParseError as exc:
|
|
23
|
+
raise SystemExit(f"Failed to parse {xml_path!r}: {exc}") from exc
|
|
24
|
+
root = tree.getroot()
|
|
25
|
+
try:
|
|
26
|
+
return float(root.attrib["line-rate"])
|
|
27
|
+
except (KeyError, ValueError) as exc:
|
|
28
|
+
raise SystemExit(f"Missing or invalid 'line-rate' in {xml_path!r}: {exc}") from exc
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def build_table(rows: list[tuple[str, float]]) -> str:
|
|
32
|
+
lines = [
|
|
33
|
+
"## Coverage Report",
|
|
34
|
+
"",
|
|
35
|
+
"| Python Version | Line Coverage |",
|
|
36
|
+
"| :---: | :---: |",
|
|
37
|
+
]
|
|
38
|
+
for version, rate in sorted(rows):
|
|
39
|
+
pct = rate * 100
|
|
40
|
+
badge = "✅" if pct >= 80 else "❌"
|
|
41
|
+
lines.append(f"| {version} | {badge} {pct:.1f}% |")
|
|
42
|
+
return "\n".join(lines) + "\n"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def main() -> None:
|
|
46
|
+
parser = argparse.ArgumentParser(
|
|
47
|
+
description="Summarise Cobertura coverage reports into a GitHub step summary."
|
|
48
|
+
)
|
|
49
|
+
parser.add_argument(
|
|
50
|
+
"entries",
|
|
51
|
+
nargs="+",
|
|
52
|
+
metavar="VERSION:XML_PATH",
|
|
53
|
+
help="Colon-separated pair of a label and the path to a Cobertura XML file.",
|
|
54
|
+
)
|
|
55
|
+
args = parser.parse_args()
|
|
56
|
+
|
|
57
|
+
rows: list[tuple[str, float]] = []
|
|
58
|
+
for entry in args.entries:
|
|
59
|
+
if ":" not in entry:
|
|
60
|
+
print(f"Error: expected VERSION:PATH, got {entry!r}", file=sys.stderr)
|
|
61
|
+
sys.exit(1)
|
|
62
|
+
version, xml_path = entry.split(":", 1)
|
|
63
|
+
rate = parse_line_coverage(xml_path)
|
|
64
|
+
rows.append((version, rate))
|
|
65
|
+
|
|
66
|
+
table = build_table(rows)
|
|
67
|
+
print(table)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
if __name__ == "__main__":
|
|
71
|
+
main()
|
|
@@ -3,7 +3,6 @@ MANIFEST.in
|
|
|
3
3
|
README.md
|
|
4
4
|
requirements.txt
|
|
5
5
|
setup.py
|
|
6
|
-
akamai/__init__.py
|
|
7
6
|
akamai/edgegrid/__init__.py
|
|
8
7
|
akamai/edgegrid/edgegrid.py
|
|
9
8
|
akamai/edgegrid/edgerc.py
|
|
@@ -15,9 +14,14 @@ akamai/edgegrid/test/sample_file.txt
|
|
|
15
14
|
akamai/edgegrid/test/test_edgegrid.py
|
|
16
15
|
akamai/edgegrid/test/testcases.json
|
|
17
16
|
akamai/edgegrid/test/testdata.json
|
|
17
|
+
ci/check_namespace_pkg.py
|
|
18
|
+
ci/coverage_report.py
|
|
18
19
|
edgegrid_python.egg-info/PKG-INFO
|
|
19
20
|
edgegrid_python.egg-info/SOURCES.txt
|
|
20
21
|
edgegrid_python.egg-info/dependency_links.txt
|
|
21
|
-
edgegrid_python.egg-info/namespace_packages.txt
|
|
22
22
|
edgegrid_python.egg-info/requires.txt
|
|
23
|
-
edgegrid_python.egg-info/top_level.txt
|
|
23
|
+
edgegrid_python.egg-info/top_level.txt
|
|
24
|
+
examples/create-credentials.py
|
|
25
|
+
examples/delete-credentials.py
|
|
26
|
+
examples/get-credentials.py
|
|
27
|
+
examples/update-credentials.py
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# This example creates your new API client credentials.
|
|
2
|
+
#
|
|
3
|
+
# To run this example:
|
|
4
|
+
#
|
|
5
|
+
# 1. Specify the location of your .edgerc file and the section header of the set of credentials to use.
|
|
6
|
+
#
|
|
7
|
+
## The defaults here expect the .edgerc at your home directory and use the credentials under the heading of default.
|
|
8
|
+
#
|
|
9
|
+
# 2. Open a Terminal or shell instance and run "python examples/create-credentials.py".
|
|
10
|
+
#
|
|
11
|
+
# A successful call returns a new API client with its credentialId. Use this ID in both the update and delete examples.
|
|
12
|
+
#
|
|
13
|
+
# For more information on the call used in this example, see https://techdocs.akamai.com/iam-api/reference/post-self-credentials.
|
|
14
|
+
|
|
15
|
+
import requests
|
|
16
|
+
import json
|
|
17
|
+
from akamai.edgegrid import EdgeGridAuth, EdgeRc
|
|
18
|
+
from urllib.parse import urljoin
|
|
19
|
+
|
|
20
|
+
edgerc = EdgeRc('~/.edgerc')
|
|
21
|
+
section = 'default'
|
|
22
|
+
baseurl = 'https://%s' % edgerc.get(section, 'host')
|
|
23
|
+
|
|
24
|
+
session = requests.Session()
|
|
25
|
+
session.auth = EdgeGridAuth.from_edgerc(edgerc, section)
|
|
26
|
+
|
|
27
|
+
path = '/identity-management/v3/api-clients/self/credentials'
|
|
28
|
+
headers = {
|
|
29
|
+
"Accept": "application/json"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
result = session.post(urljoin(baseurl, path), headers=headers)
|
|
33
|
+
print(result.status_code)
|
|
34
|
+
print(json.dumps(result.json(), indent=2))
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# This example deletes your API client credentials.
|
|
2
|
+
#
|
|
3
|
+
# To run this example:
|
|
4
|
+
#
|
|
5
|
+
# 1. Specify the location of your .edgerc file and the section header of the set of credentials to use.
|
|
6
|
+
#
|
|
7
|
+
# The defaults here expect the .edgerc at your home directory and use the credentials under the heading of default.
|
|
8
|
+
#
|
|
9
|
+
# 2. Add the credentialId from the update example to the path. You can only delete inactive credentials. Sending the request on an active set will return a 400. Use the update credentials example for deactivation.
|
|
10
|
+
#
|
|
11
|
+
# **Important:** Don't use the credentials you're actively using when deleting a set of credentials. Otherwise, you'll block your access to the Akamai APIs.
|
|
12
|
+
#
|
|
13
|
+
# 3. Open a Terminal or shell instance and run "python examples/delete-credentials.py".
|
|
14
|
+
#
|
|
15
|
+
# A successful call returns "" null.
|
|
16
|
+
#
|
|
17
|
+
# For more information on the call used in this example, see https://techdocs.akamai.com/iam-api/reference/delete-self-credential.
|
|
18
|
+
|
|
19
|
+
import requests
|
|
20
|
+
import json
|
|
21
|
+
from akamai.edgegrid import EdgeGridAuth, EdgeRc
|
|
22
|
+
from urllib.parse import urljoin
|
|
23
|
+
|
|
24
|
+
edgerc = EdgeRc('~/.edgerc')
|
|
25
|
+
section = 'default'
|
|
26
|
+
baseurl = 'https://%s' % edgerc.get(section, 'host')
|
|
27
|
+
|
|
28
|
+
session = requests.Session()
|
|
29
|
+
session.auth = EdgeGridAuth.from_edgerc(edgerc, section)
|
|
30
|
+
credentialId = 123456
|
|
31
|
+
|
|
32
|
+
path = '/identity-management/v3/api-clients/self/credentials/{}'.format(credentialId)
|
|
33
|
+
|
|
34
|
+
result = session.delete(urljoin(baseurl, path))
|
|
35
|
+
print(result.status_code)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# This example returns a list of your API client credentials.
|
|
2
|
+
#
|
|
3
|
+
# To run this example:
|
|
4
|
+
#
|
|
5
|
+
# 1. Specify the location of your .edgerc file and the section header of the set of credentials to use.
|
|
6
|
+
#
|
|
7
|
+
# The defaults here expect the .edgerc at your home directory and use the credentials under the heading of default.
|
|
8
|
+
#
|
|
9
|
+
# 2. Open a Terminal or shell instance and run "python examples/get-credentials.py".
|
|
10
|
+
#
|
|
11
|
+
# A successful call returns your credentials grouped by credentialId.
|
|
12
|
+
#
|
|
13
|
+
# For more information on the call used in this example, see https://techdocs.akamai.com/iam-api/reference/get-self-credentials.
|
|
14
|
+
|
|
15
|
+
import requests
|
|
16
|
+
import json
|
|
17
|
+
from akamai.edgegrid import EdgeGridAuth, EdgeRc
|
|
18
|
+
from urllib.parse import urljoin
|
|
19
|
+
|
|
20
|
+
edgerc = EdgeRc('~/.edgerc')
|
|
21
|
+
section = 'default'
|
|
22
|
+
baseurl = 'https://%s' % edgerc.get(section, 'host')
|
|
23
|
+
|
|
24
|
+
session = requests.Session()
|
|
25
|
+
session.auth = EdgeGridAuth.from_edgerc(edgerc, section)
|
|
26
|
+
|
|
27
|
+
path = '/identity-management/v3/api-clients/self/credentials'
|
|
28
|
+
headers = {
|
|
29
|
+
"Accept": "application/json"}
|
|
30
|
+
querystring = {
|
|
31
|
+
"actions": True
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
result = session.get(urljoin(baseurl, path), headers=headers, params=querystring)
|
|
35
|
+
print(result.status_code)
|
|
36
|
+
print(json.dumps(result.json(), indent=2))
|
|
37
|
+
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# This example updates the credentials from the create credentials example.
|
|
2
|
+
#
|
|
3
|
+
# To run this example:
|
|
4
|
+
#
|
|
5
|
+
# 1. Specify the location of your .edgerc file and the section header of the set of credentials to use.
|
|
6
|
+
#
|
|
7
|
+
# The defaults here expect the .edgerc at your home directory and use the credentials under the heading of default.
|
|
8
|
+
#
|
|
9
|
+
# 2. Add the credentialId for the set of credentials created using the create example as a path parameter.
|
|
10
|
+
#
|
|
11
|
+
# 3. Edit the expiresOn date to today's date. Optionally, you can change the description value.
|
|
12
|
+
#
|
|
13
|
+
# **Important:** Don't use the credentials you're actively using when inactivating a set of credentials. Otherwise, you'll block your access to the Akamai APIs.
|
|
14
|
+
#
|
|
15
|
+
# 4. Open a Terminal or shell instance and run "python examples/update-credentials.py".
|
|
16
|
+
#
|
|
17
|
+
# A successful call returns.
|
|
18
|
+
#
|
|
19
|
+
# For more information on the call used in this example, see https://techdocs.akamai.com/iam-api/reference/put-self-credential.
|
|
20
|
+
|
|
21
|
+
import requests
|
|
22
|
+
import json
|
|
23
|
+
from akamai.edgegrid import EdgeGridAuth, EdgeRc
|
|
24
|
+
from urllib.parse import urljoin
|
|
25
|
+
|
|
26
|
+
edgerc = EdgeRc('~/.edgerc')
|
|
27
|
+
section = 'default'
|
|
28
|
+
baseurl = 'https://%s' % edgerc.get(section, 'host')
|
|
29
|
+
|
|
30
|
+
session = requests.Session()
|
|
31
|
+
session.auth = EdgeGridAuth.from_edgerc(edgerc, section)
|
|
32
|
+
credentialId = 123456
|
|
33
|
+
|
|
34
|
+
path = '/identity-management/v3/api-clients/self/credentials/{}'.format(credentialId)
|
|
35
|
+
headers = {
|
|
36
|
+
"Content-Type": "application/json",
|
|
37
|
+
"Accept": "application/json"}
|
|
38
|
+
payload = {
|
|
39
|
+
"status": "INACTIVE",
|
|
40
|
+
"expiresOn": "2024-12-30T22:09:24.000Z", # The date cannot be more than two years out or it will return a 400
|
|
41
|
+
"description": "Update this credential"
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
result = session.put(urljoin(baseurl, path), headers=headers, json=payload)
|
|
45
|
+
print(result.status_code)
|
|
46
|
+
print(json.dumps(result.json(), indent=2))
|
|
47
|
+
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
from setuptools import setup,
|
|
1
|
+
from setuptools import setup, find_namespace_packages
|
|
2
|
+
|
|
2
3
|
|
|
3
4
|
setup(
|
|
4
5
|
name='edgegrid-python',
|
|
5
|
-
version='2.0.
|
|
6
|
+
version='2.0.6',
|
|
6
7
|
description='{OPEN} client authentication protocol for python-requests',
|
|
7
8
|
url='https://github.com/akamai/AkamaiOPEN-edgegrid-python',
|
|
8
|
-
|
|
9
|
-
packages=find_packages(),
|
|
9
|
+
packages=find_namespace_packages(),
|
|
10
10
|
python_requires=">=3.10",
|
|
11
11
|
long_description=open("README.md").read(),
|
|
12
12
|
long_description_content_type="text/markdown",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
akamai
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
akamai
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/akamai/edgegrid/test/edgerc_that_doesnt_parse
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{edgegrid_python-2.0.5 → edgegrid_python-2.0.6}/edgegrid_python.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|