Skip to content

Commit 2daf9b9

Browse files
all exceptions in one file.
1 parent fc72103 commit 2daf9b9

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

pythonanywhere_core/base.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,13 @@
33

44
import requests
55

6+
from pythonanywhere_core.exceptions import AuthenticationError, NoTokenError
7+
68
PYTHON_VERSIONS: Dict[str, str] = {
7-
"3.6": "python36", "3.7": "python37", "3.8": "python38",
9+
"3.6": "python36", "3.7": "python37", "3.8": "python38", "3.9": "python39"
810
}
911

1012

11-
class AuthenticationError(Exception):
12-
pass
13-
14-
15-
class NoTokenError(Exception):
16-
pass
17-
18-
1913
def get_api_endpoint() -> str:
2014
hostname = os.environ.get(
2115
"PYTHONANYWHERE_SITE",

pythonanywhere_core/exceptions.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class AuthenticationError(Exception):
2+
pass
3+
4+
5+
class SanityException(Exception):
6+
pass
7+
8+
9+
class NoTokenError(Exception):
10+
pass

tests/test_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import pytest
22
import responses
33

4-
from pythonanywhere_core.base import AuthenticationError, call_api, get_api_endpoint
5-
4+
from pythonanywhere_core.base import call_api, get_api_endpoint
5+
from pythonanywhere_core.exceptions import AuthenticationError
66

77
@pytest.fixture
88
def mock_requests(mocker):

0 commit comments

Comments
 (0)