Skip to content

Commit 6f5b004

Browse files
authored
Upgrade + add logging (#17)
* Upgrade + add logging * bump pre-commit
1 parent e399421 commit 6f5b004

File tree

6 files changed

+121
-52
lines changed

6 files changed

+121
-52
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ jobs:
2121
${{ runner.os }}-poetry-
2222
- uses: actions/setup-python@v4
2323
with:
24-
python-version: '3.10'
24+
python-version: '3.11'
2525
- name: Install poetry
2626
uses: abatilo/actions-poetry@v2.3.0
2727
with:
28-
poetry-version: '1.3.1'
28+
poetry-version: '1.5.0'
2929
- name: Install pip dependencies
3030
run: poetry install
3131
- uses: pre-commit/action@v3.0.0
@@ -41,11 +41,11 @@ jobs:
4141
${{ runner.os }}-poetry-
4242
- uses: actions/setup-python@v4
4343
with:
44-
python-version: '3.10'
44+
python-version: '3.11'
4545
- name: Install poetry
4646
uses: abatilo/actions-poetry@v2.3.0
4747
with:
48-
poetry-version: '1.3.1'
48+
poetry-version: '1.5.0'
4949
- name: Install pip dependencies
5050
run: poetry install
5151
- name: Run tests

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
- uses: actions/checkout@master
1212
- uses: actions/setup-python@v4
1313
with:
14-
python-version: '3.10'
14+
python-version: '3.11'
1515
- name: Install poetry
1616
uses: abatilo/actions-poetry@v2.3.0
1717
with:
18-
poetry-version: '1.3.1'
18+
poetry-version: '1.5.0'
1919
- name: Install pip dependencies
2020
run: poetry install
2121
- name: Package

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ repos:
88
- id: check-toml
99
- id: check-added-large-files
1010
- repo: https://github.com/psf/black
11-
rev: 22.10.0
11+
rev: 23.3.0
1212
hooks:
1313
- id: black
1414
- repo: https://github.com/pre-commit/mirrors-isort
@@ -17,7 +17,7 @@ repos:
1717
- id: isort
1818
additional_dependencies: [toml]
1919
- repo: https://github.com/pre-commit/mirrors-mypy
20-
rev: v0.991
20+
rev: v1.3.0
2121
hooks:
2222
- id: mypy
2323
additional_dependencies: [types-requests]

edge_addons_api/client.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class Options:
2525

2626

2727
class Client:
28-
2928
BASE_URL = "https://api.addons.microsoftedge.microsoft.com"
3029

3130
def __init__(self, options: Options):
@@ -41,6 +40,7 @@ def submit(self, file_path: str, notes: str) -> str:
4140
return self._publish(notes, access_token)
4241

4342
def fetch_publish_status(self, operation_id: str) -> dict:
43+
logger.debug(f"Fetching publish status for {operation_id}")
4444
access_token = self._get_access_token()
4545
response = requests.get(
4646
self._publish_status_endpoint(operation_id),
@@ -50,9 +50,12 @@ def fetch_publish_status(self, operation_id: str) -> dict:
5050
)
5151

5252
response.raise_for_status()
53+
54+
logger.debug(f"Publish status response: {response.content.decode()}")
5355
return response.json()
5456

5557
def _publish(self, notes: str, access_token: str) -> str:
58+
logger.debug("Publishing")
5659
response = requests.post(
5760
self._publish_endpoint(),
5861
data={"notes": notes},
@@ -68,6 +71,7 @@ def _publish(self, notes: str, access_token: str) -> str:
6871
return response.headers["Location"]
6972

7073
def _upload(self, file_path: str, access_token: str) -> str:
74+
logger.debug(f"Uploading {file_path}")
7175
with open(file_path, "rb") as f:
7276
response = requests.post(
7377
self._upload_endpoint(),
@@ -80,6 +84,8 @@ def _upload(self, file_path: str, access_token: str) -> str:
8084

8185
response.raise_for_status()
8286

87+
logger.debug("Finished upload")
88+
8389
return response.headers["Location"]
8490

8591
def _check_upload(
@@ -89,6 +95,8 @@ def _check_upload(
8995
retry_count: int = 5,
9096
sleep_seconds: int = 3,
9197
) -> str:
98+
logger.debug("Checking upload")
99+
92100
upload_status = ""
93101
attempts = 0
94102

0 commit comments

Comments
 (0)