aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2025-07-16 10:08:40 +0100
committerGravatar Joe Banks <[email protected]>2025-07-16 10:08:40 +0100
commitbf4cb2c12ad9fb71233c5ed60ec4cd717f6302de (patch)
treeb75098aa3a962829d65129fab049a9a550847aee
parentAdd new M-x github remove command (diff)
Move common variables for GitHub API into common file
-rw-r--r--arthur/apis/github/__init__.py20
-rw-r--r--arthur/apis/github/common.py18
-rw-r--r--arthur/apis/github/orgs.py2
-rw-r--r--arthur/apis/github/teams.py2
4 files changed, 21 insertions, 21 deletions
diff --git a/arthur/apis/github/__init__.py b/arthur/apis/github/__init__.py
index 3eb55a6..a8701d4 100644
--- a/arthur/apis/github/__init__.py
+++ b/arthur/apis/github/__init__.py
@@ -1,23 +1,5 @@
-from arthur.config import CONFIG
-
+from .common import GitHubError
from .orgs import remove_org_member
from .teams import add_staff_member
-
-class GitHubError(Exception):
- """Custom exception for GitHub API errors."""
-
- def __init__(self, message: str):
- super().__init__(message)
-
-
__all__ = ("GitHubError", "add_staff_member", "remove_org_member")
-
-HEADERS = {
- "Accept": "application/vnd.github+json",
- "X-GitHub-Api-Version": "2022-11-28",
- "Authorization": f"Bearer {CONFIG.github_token.get_secret_value()}",
-}
-HTTP_404 = 404
-HTTP_403 = 403
-HTTP_422 = 422
diff --git a/arthur/apis/github/common.py b/arthur/apis/github/common.py
new file mode 100644
index 0000000..5ac4676
--- /dev/null
+++ b/arthur/apis/github/common.py
@@ -0,0 +1,18 @@
+from arthur.config import CONFIG
+
+
+class GitHubError(Exception):
+ """Custom exception for GitHub API errors."""
+
+ def __init__(self, message: str):
+ super().__init__(message)
+
+
+HEADERS = {
+ "Accept": "application/vnd.github+json",
+ "X-GitHub-Api-Version": "2022-11-28",
+ "Authorization": f"Bearer {CONFIG.github_token.get_secret_value()}",
+}
+HTTP_404 = 404
+HTTP_403 = 403
+HTTP_422 = 422
diff --git a/arthur/apis/github/orgs.py b/arthur/apis/github/orgs.py
index 55039c8..60255ac 100644
--- a/arthur/apis/github/orgs.py
+++ b/arthur/apis/github/orgs.py
@@ -1,6 +1,6 @@
import aiohttp
-from arthur.apis.github import GitHubError, HEADERS, HTTP_403, HTTP_404
+from arthur.apis.github.common import GitHubError, HEADERS, HTTP_403, HTTP_404
from arthur.config import CONFIG
diff --git a/arthur/apis/github/teams.py b/arthur/apis/github/teams.py
index e919051..879581f 100644
--- a/arthur/apis/github/teams.py
+++ b/arthur/apis/github/teams.py
@@ -1,6 +1,6 @@
import aiohttp
-from arthur.apis.github import GitHubError, HEADERS, HTTP_403, HTTP_404, HTTP_422
+from arthur.apis.github.common import GitHubError, HEADERS, HTTP_403, HTTP_404, HTTP_422
from arthur.config import CONFIG