gitcode-api 1.2.20__py3-none-any.whl → 1.2.21__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.
- gitcode_api/_base_client.py +7 -2
- gitcode_api/_exceptions.py +6 -0
- gitcode_api/version.txt +1 -1
- {gitcode_api-1.2.20.dist-info → gitcode_api-1.2.21.dist-info}/METADATA +3 -3
- {gitcode_api-1.2.20.dist-info → gitcode_api-1.2.21.dist-info}/RECORD +9 -9
- {gitcode_api-1.2.20.dist-info → gitcode_api-1.2.21.dist-info}/WHEEL +0 -0
- {gitcode_api-1.2.20.dist-info → gitcode_api-1.2.21.dist-info}/entry_points.txt +0 -0
- {gitcode_api-1.2.20.dist-info → gitcode_api-1.2.21.dist-info}/licenses/LICENSE +0 -0
- {gitcode_api-1.2.20.dist-info → gitcode_api-1.2.21.dist-info}/top_level.txt +0 -0
gitcode_api/_base_client.py
CHANGED
|
@@ -11,7 +11,7 @@ from urllib.parse import quote
|
|
|
11
11
|
import httpx
|
|
12
12
|
|
|
13
13
|
from ._base_resource import BaseResource
|
|
14
|
-
from ._exceptions import GitCodeConfigurationError, GitCodeHTTPStatusError
|
|
14
|
+
from ._exceptions import GitCodeConfigurationError, GitCodeHTTPStatusError, GitCodeTokenError, GitCodeUnauthorizedError
|
|
15
15
|
from .constants import DEFAULT_BASE_URL, DEFAULT_CA_ENV, DEFAULT_TIMEOUT, DEFAULT_TOKEN_ENV
|
|
16
16
|
|
|
17
17
|
|
|
@@ -165,7 +165,12 @@ class BaseGitCodeClient:
|
|
|
165
165
|
except ValueError:
|
|
166
166
|
payload = response.text
|
|
167
167
|
|
|
168
|
-
|
|
168
|
+
error_cls = GitCodeHTTPStatusError
|
|
169
|
+
if response.status_code == 401:
|
|
170
|
+
error_cls = GitCodeUnauthorizedError
|
|
171
|
+
if "token" in (str(payload) or message).lower():
|
|
172
|
+
error_cls = GitCodeTokenError
|
|
173
|
+
raise error_cls(
|
|
169
174
|
message or f"GitCode API request failed with status {response.status_code}.",
|
|
170
175
|
status_code=response.status_code,
|
|
171
176
|
request_id=response.headers.get("X-Request-Id"),
|
gitcode_api/_exceptions.py
CHANGED
|
@@ -37,3 +37,9 @@ class GitCodeAPIError(GitCodeError):
|
|
|
37
37
|
|
|
38
38
|
class GitCodeHTTPStatusError(GitCodeAPIError):
|
|
39
39
|
"""Raised for non-success HTTP responses from the GitCode API."""
|
|
40
|
+
|
|
41
|
+
class GitCodeUnauthorizedError(GitCodeHTTPStatusError):
|
|
42
|
+
"""Raised for 401 unauthorized HTTP responses from the GitCode API."""
|
|
43
|
+
|
|
44
|
+
class GitCodeTokenError(GitCodeUnauthorizedError):
|
|
45
|
+
"""Raised for invalid token from the GitCode API."""
|
gitcode_api/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
1.2.
|
|
1
|
+
1.2.21
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: gitcode-api
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.21
|
|
4
4
|
Summary: Easy to use Python SDK for the GitCode REST API. Providing builtin CLI tool, and optional LLM integration (MCP, OpenAI tool, and openJiuwen tool) for agents. Community-maintained.
|
|
5
5
|
Author-email: Hugo Huang <hugo@hugohuang.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -37,9 +37,9 @@ Dynamic: license-file
|
|
|
37
37
|
|
|
38
38
|
# GitCode-API
|
|
39
39
|
|
|
40
|
-
[](https://pypi.org/project/gitcode-api) [](https://pepy.tech/projects/gitcode-api)
|
|
41
41
|
[](https://cursor.com/en/install-mcp?name=GitCode%20API&config=eyJjb21tYW5kIjoidXZ4IiwiYXJncyI6WyItLWZyb20iLCJnaXRjb2RlLWFwaVttY3BdIiwiZ2l0Y29kZS1hcGkiLCJzZXJ2ZSJdLCJlbnYiOnsiR0lUQ09ERV9BQ0NFU1NfVE9LRU4iOiIke2lucHV0OmdpdGNvZGVfYWNjZXNzX3Rva2VufSJ9LCJpbnB1dHMiOlt7ImlkIjoiZ2l0Y29kZV9hY2Nlc3NfdG9rZW4iLCJ0eXBlIjoicHJvbXB0U3RyaW5nIiwiZGVzY3JpcHRpb24iOiJFbnRlciBHSVRDT0RFX0FDQ0VTU19UT0tFTiIsInBhc3N3b3JkIjp0cnVlfV19) [](https://vscode.dev/redirect/mcp/install?name=GitCode%20API&config=%7B%22command%22%3A%22uvx%22%2C%22args%22%3A%5B%22--from%22%2C%22gitcode-api%5Bmcp%5D%22%2C%22gitcode-api%22%2C%22serve%22%5D%2C%22env%22%3A%7B%22GITCODE_ACCESS_TOKEN%22%3A%22%24%7Binput%3Agitcode_access_token%7D%22%7D%2C%22inputs%22%3A%5B%7B%22id%22%3A%22gitcode_access_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22Enter%20GITCODE_ACCESS_TOKEN%22%2C%22password%22%3Atrue%7D%5D%7D)
|
|
42
|
-
[](https://github.com/Trenza1ore/GitCode-API) [](https://gitcode.com/SushiNinja/GitCode-API)
|
|
42
|
+
[](https://github.com/Trenza1ore/GitCode-API) [](https://gitcode.com/SushiNinja/GitCode-API) [](https://github.com/Trenza1ore/GitCode-API/actions/workflows/check-code.yml/)
|
|
43
43
|
|
|
44
44
|
[](https://gitcode-api.readthedocs.io) [](README.zh.md)
|
|
45
45
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
gitcode_api/__init__.py,sha256=94gg5E1bAWozIR6PBYIPdZMfj-VyBFJp_rQQda2Qagk,1672
|
|
2
2
|
gitcode_api/__main__.py,sha256=Yd8P4MSNcWFqUTKnUaNibbWX4Vd-MVVNmhPFaohzqcA,137
|
|
3
|
-
gitcode_api/_base_client.py,sha256=
|
|
3
|
+
gitcode_api/_base_client.py,sha256=jNFrN2IIao9TGqvOsc33SRxUIQ5JQIY1iYCuyUsK-u0,14238
|
|
4
4
|
gitcode_api/_base_resource.py,sha256=mlKe1b_1AKcqxhptaCpP-AOjKkLNzCbYG-Pkp1HYWrA,2238
|
|
5
5
|
gitcode_api/_cli_banner.py,sha256=S6i8dnzCXrxytrboxNh_gz-x95u6w9E-Yz6IkTz2PJk,1576
|
|
6
6
|
gitcode_api/_client.py,sha256=bmZxBHdfshM5Kv_EurHUVu8rsEj0k3Up3ATSIPaFrvc,8258
|
|
7
|
-
gitcode_api/_exceptions.py,sha256=
|
|
7
|
+
gitcode_api/_exceptions.py,sha256=rsWt5KduumSHjJPPAi_SxtnpkgWYO7lQ7ObwMV2CTGI,1381
|
|
8
8
|
gitcode_api/_models.py,sha256=ip0xgdWao8Z3ATfSaPn3KzG81OXd25RVB1ansOaJaUM,110586
|
|
9
9
|
gitcode_api/cli.py,sha256=7ZrpWIh5zZdftMhbMjldiuvijig8qKLFiQbof93Cy6k,18792
|
|
10
10
|
gitcode_api/constants.py,sha256=uzcI7dVq4Qx_toYtnIphUh1IGepv9NuOdJ4DCswiYgo,769
|
|
11
11
|
gitcode_api/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
12
|
gitcode_api/run_mcp.py,sha256=3_JOrjg9_yL-0M-H-F8mPgxdVKh7K2ggipu7UHeNCg0,147
|
|
13
13
|
gitcode_api/utils.py,sha256=51QmPTQPeNsPSGf2IzhwmiEO1H2GkJrp2A7vkzhOOag,1351
|
|
14
|
-
gitcode_api/version.txt,sha256=
|
|
14
|
+
gitcode_api/version.txt,sha256=WVrTloMXahqXpyQ77FyHu13i8taohRDnlzlYlFuXhHg,7
|
|
15
15
|
gitcode_api/llm/__init__.py,sha256=rU75ZlJvTWNVxBLc3QzdfWmSjqVc9z6hfQ8z6jVVKOk,1693
|
|
16
16
|
gitcode_api/llm/_tool.py,sha256=b65iUiHo1H29uA6mFM3WlD0zZlISsENx1tpEqlkiUoA,16239
|
|
17
17
|
gitcode_api/llm/jiuwen.py,sha256=qca2y4544xoRYFOCMbkjiUZZLpJGMcBkK4w5bqs60-4,4276
|
|
@@ -23,9 +23,9 @@ gitcode_api/resources/account.py,sha256=OMuGxfxazYBz8Ii1PumKPJlgcmgmZu9ztJqvKC-F
|
|
|
23
23
|
gitcode_api/resources/collaboration.py,sha256=pdQkkm8xl5EQgGVj2WXSx1TFclDlYMCzi0nBtNDFXuI,116558
|
|
24
24
|
gitcode_api/resources/misc.py,sha256=w7bq8rmgKr2ScBKeWZ3EZJmAdylDdPtSPrhi3AQre7w,34747
|
|
25
25
|
gitcode_api/resources/repositories.py,sha256=T-xy1gVzqudfpm2J8na1RrRTrMRYCbYI65e4w3f13n4,84402
|
|
26
|
-
gitcode_api-1.2.
|
|
27
|
-
gitcode_api-1.2.
|
|
28
|
-
gitcode_api-1.2.
|
|
29
|
-
gitcode_api-1.2.
|
|
30
|
-
gitcode_api-1.2.
|
|
31
|
-
gitcode_api-1.2.
|
|
26
|
+
gitcode_api-1.2.21.dist-info/licenses/LICENSE,sha256=gOACXuWhMu6PJKVLr9RQbxX3HULnZIGNXCaMFJIXhoA,1067
|
|
27
|
+
gitcode_api-1.2.21.dist-info/METADATA,sha256=C23RVosYLPqWDS9jhuIRlRtH_syH4TkeTNI0dT2K2Es,23649
|
|
28
|
+
gitcode_api-1.2.21.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
29
|
+
gitcode_api-1.2.21.dist-info/entry_points.txt,sha256=dIPylJcgohIE2RRIlt3In2WzcwDK8TOdkL_ReKuij4o,53
|
|
30
|
+
gitcode_api-1.2.21.dist-info/top_level.txt,sha256=gIlg0ptyOUHJT64ajOjWIhRPYgIQnMIvnhhnesw9fxU,12
|
|
31
|
+
gitcode_api-1.2.21.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|