imbi-plugin-github 2.60.0__py3-none-any.whl → 2.61.0__py3-none-any.whl
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.
- imbi/plugins/github/public.py +11 -11
- {imbi_plugin_github-2.60.0.dist-info → imbi_plugin_github-2.61.0.dist-info}/METADATA +2 -2
- {imbi_plugin_github-2.60.0.dist-info → imbi_plugin_github-2.61.0.dist-info}/RECORD +4 -4
- {imbi_plugin_github-2.60.0.dist-info → imbi_plugin_github-2.61.0.dist-info}/WHEEL +0 -0
imbi/plugins/github/public.py
CHANGED
|
@@ -22,10 +22,12 @@ class PublicRepository:
|
|
|
22
22
|
"""The :class:`~imbi.common.plugins.base.RepositoryReader` of a public
|
|
23
23
|
``github.com`` repository. It ignores ``ctx`` and ``credentials``."""
|
|
24
24
|
|
|
25
|
-
# ponytail: 60 unauthenticated requests an hour per API pod IP
|
|
26
|
-
# an org token if many public marketplaces sync
|
|
25
|
+
# ponytail: 60 unauthenticated API requests an hour per API pod IP
|
|
26
|
+
# for the refs; use an org token if many public marketplaces sync
|
|
27
|
+
# often.
|
|
27
28
|
def __init__(self, owner: str, repo: str) -> None:
|
|
28
29
|
self.base = f'https://api.github.com/repos/{owner}/{repo}'
|
|
30
|
+
self.raw = f'https://raw.githubusercontent.com/{owner}/{repo}'
|
|
29
31
|
|
|
30
32
|
@classmethod
|
|
31
33
|
def for_url(cls, url: str) -> PublicRepository | None:
|
|
@@ -37,21 +39,21 @@ class PublicRepository:
|
|
|
37
39
|
return None
|
|
38
40
|
return cls(*path.split('/'))
|
|
39
41
|
|
|
40
|
-
async def _get(
|
|
41
|
-
self, path: str, accept: str = 'application/vnd.github+json'
|
|
42
|
-
) -> httpx.Response:
|
|
42
|
+
async def _get(self, url: str) -> httpx.Response:
|
|
43
43
|
# A renamed or moved repository answers 301 to /repositories/{id}.
|
|
44
44
|
async with httpx.AsyncClient(
|
|
45
45
|
timeout=30, follow_redirects=True
|
|
46
46
|
) as client:
|
|
47
47
|
return await client.get(
|
|
48
|
-
|
|
48
|
+
url, headers={'Accept': 'application/vnd.github+json'}
|
|
49
49
|
)
|
|
50
50
|
|
|
51
51
|
async def resolve_committish(
|
|
52
52
|
self, _ctx: object, _credentials: object, ref: str, /
|
|
53
53
|
) -> base.Ref:
|
|
54
|
-
response = await self._get(
|
|
54
|
+
response = await self._get(
|
|
55
|
+
f'{self.base}/commits/{urllib.parse.quote(ref)}'
|
|
56
|
+
)
|
|
55
57
|
response.raise_for_status()
|
|
56
58
|
return base.Ref(name=ref, kind='branch', sha=response.json()['sha'])
|
|
57
59
|
|
|
@@ -64,7 +66,7 @@ class PublicRepository:
|
|
|
64
66
|
) -> list[base.Ref]:
|
|
65
67
|
"""Return the default branch only, whatever ``kind`` is."""
|
|
66
68
|
del kind
|
|
67
|
-
response = await self._get(
|
|
69
|
+
response = await self._get(self.base)
|
|
68
70
|
response.raise_for_status()
|
|
69
71
|
branch = str(response.json()['default_branch'])
|
|
70
72
|
ref = await self.resolve_committish(None, None, branch)
|
|
@@ -74,9 +76,7 @@ class PublicRepository:
|
|
|
74
76
|
self, _ctx: object, _credentials: object, path: str, ref: str, /
|
|
75
77
|
) -> str | None:
|
|
76
78
|
response = await self._get(
|
|
77
|
-
f'/
|
|
78
|
-
f'{urllib.parse.urlencode({"ref": ref})}',
|
|
79
|
-
'application/vnd.github.raw+json',
|
|
79
|
+
f'{self.raw}/{urllib.parse.quote(ref)}/{urllib.parse.quote(path)}'
|
|
80
80
|
)
|
|
81
81
|
if response.status_code == 404:
|
|
82
82
|
return None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: imbi-plugin-github
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.61.0
|
|
4
4
|
Summary: GitHub identity plugin for Imbi (github.com / GHEC / GHES)
|
|
5
5
|
Author-email: "Gavin M. Roy" <gavinr@aweber.com>
|
|
6
6
|
License-Expression: BSD-3-Clause
|
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.14
|
|
13
13
|
Requires-Python: >=3.14
|
|
14
14
|
Requires-Dist: httpx>=0.27
|
|
15
|
-
Requires-Dist: imbi-common[databases]==2.
|
|
15
|
+
Requires-Dist: imbi-common[databases]==2.61.0
|
|
16
16
|
Requires-Dist: pydantic>=2
|
|
17
17
|
Requires-Dist: pyjwt[crypto]>=2.8
|
|
18
18
|
Description-Content-Type: text/markdown
|
|
@@ -9,10 +9,10 @@ imbi/plugins/github/doctor.py,sha256=sIps9YyDFLva7JHyKJU0IkKSW8tiI-PArC0s1ytxv3w
|
|
|
9
9
|
imbi/plugins/github/identity.py,sha256=9t_e-_jUbQ1iL0Vb6vaK2d7bT1ki6pw9aWwc4ics6gI,10354
|
|
10
10
|
imbi/plugins/github/lifecycle.py,sha256=wxcsZJ9-cELzb8nmh7x-jwmJx3vQ_kj9-5uWCchYkyA,39451
|
|
11
11
|
imbi/plugins/github/plugin.py,sha256=LDFCqj6e2jfF9io3U7cC0eVOUAxw1ENvFS-0AWOMuDc,16073
|
|
12
|
-
imbi/plugins/github/public.py,sha256=
|
|
12
|
+
imbi/plugins/github/public.py,sha256=Rrm_vLLvin0ZtCFyj5vtwbgZX2LpxoBsXMCcDd2AM84,3118
|
|
13
13
|
imbi/plugins/github/pull_requests.py,sha256=DH9CnJoCpY5Ats5sZ_ktLvy54kBwK9g_-CDMlAIOq7Y,32553
|
|
14
14
|
imbi/plugins/github/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
imbi/plugins/github/secret_provider.py,sha256=x07_n70dno1lSBgFfl8D-sY4soPatfrZv5AmqY0ROLg,30895
|
|
16
|
-
imbi_plugin_github-2.
|
|
17
|
-
imbi_plugin_github-2.
|
|
18
|
-
imbi_plugin_github-2.
|
|
16
|
+
imbi_plugin_github-2.61.0.dist-info/METADATA,sha256=Ogz0c9X3yO-slpTuhSBCOT68raT26b6s4rzeEUE0jCI,8977
|
|
17
|
+
imbi_plugin_github-2.61.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
18
|
+
imbi_plugin_github-2.61.0.dist-info/RECORD,,
|
|
File without changes
|