Skip to content

Commit bf4cb2c

Browse files
committed
Move common variables for GitHub API into common file
1 parent c4f844e commit bf4cb2c

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

arthur/apis/github/__init__.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
1-
from arthur.config import CONFIG
2-
1+
from .common import GitHubError
32
from .orgs import remove_org_member
43
from .teams import add_staff_member
54

6-
7-
class GitHubError(Exception):
8-
"""Custom exception for GitHub API errors."""
9-
10-
def __init__(self, message: str):
11-
super().__init__(message)
12-
13-
145
__all__ = ("GitHubError", "add_staff_member", "remove_org_member")
15-
16-
HEADERS = {
17-
"Accept": "application/vnd.github+json",
18-
"X-GitHub-Api-Version": "2022-11-28",
19-
"Authorization": f"Bearer {CONFIG.github_token.get_secret_value()}",
20-
}
21-
HTTP_404 = 404
22-
HTTP_403 = 403
23-
HTTP_422 = 422

arthur/apis/github/common.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from arthur.config import CONFIG
2+
3+
4+
class GitHubError(Exception):
5+
"""Custom exception for GitHub API errors."""
6+
7+
def __init__(self, message: str):
8+
super().__init__(message)
9+
10+
11+
HEADERS = {
12+
"Accept": "application/vnd.github+json",
13+
"X-GitHub-Api-Version": "2022-11-28",
14+
"Authorization": f"Bearer {CONFIG.github_token.get_secret_value()}",
15+
}
16+
HTTP_404 = 404
17+
HTTP_403 = 403
18+
HTTP_422 = 422

arthur/apis/github/orgs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import aiohttp
22

3-
from arthur.apis.github import GitHubError, HEADERS, HTTP_403, HTTP_404
3+
from arthur.apis.github.common import GitHubError, HEADERS, HTTP_403, HTTP_404
44
from arthur.config import CONFIG
55

66

arthur/apis/github/teams.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import aiohttp
22

3-
from arthur.apis.github import GitHubError, HEADERS, HTTP_403, HTTP_404, HTTP_422
3+
from arthur.apis.github.common import GitHubError, HEADERS, HTTP_403, HTTP_404, HTTP_422
44
from arthur.config import CONFIG
55

66

0 commit comments

Comments
 (0)