Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
steps:
- name: Checkout source code
uses: actions/checkout@v4
Expand Down Expand Up @@ -142,7 +142,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12', '3.13' ]
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
steps:
- name: source code
uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ dmypy.json
.pyre/

.idea
.vscode/
.vscode/
2 changes: 1 addition & 1 deletion .mypy.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[mypy]
python_version = 3.8
python_version = 3.9
follow_imports = skip
ignore_missing_imports = True
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,25 @@ repos:
- id: check-yaml

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 24.3.0
hooks:
- id: black
language_version: python3.8
language_version: python3.9
args: [--line-length=120, --skip-string-normalization]

- repo: https://github.com/pycqa/flake8
rev: 6.0.0
rev: 7.2.0
hooks:
- id: flake8

- repo: https://github.com/pycqa/isort
rev: 5.11.5
rev: 6.0.1
hooks:
- id: isort
stages: [commit]
stages: [pre-commit]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
rev: v1.15.0
hooks:
- id: mypy
args: [--no-error-summary, --hide-error-codes, --follow-imports=skip]
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## 4.0.0
* [BREAKING] Drop support of **Python 3.8** and update dependencies.

## 3.12.1
* [FIX] `google-auth` deals with offset-maive datetime objct when validating token. Method `async_firebase.base.AsyncClientBase._get_access_token` is adjusted to replace tzinfo with `None`.

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,5 @@ install_pre_commit:
.PHONY: pre_commit
pre_commit:
@echo "$(BOLD)Run pre-commit$(RESET)"
@pre-commit run -a
@pre-commit run --all-files
@echo "$(BOLD)Done!$(RESET)"
1 change: 1 addition & 0 deletions async_firebase/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Documentation for google-auth package https://google-auth.readthedocs.io/en/latest/user-guide.html that is used
to authorize request which is being made to Firebase.
"""

import logging
import typing as t
import uuid
Expand Down
1 change: 1 addition & 0 deletions async_firebase/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Documentation for google-auth package https://google-auth.readthedocs.io/en/latest/user-guide.html that is used
to authorize request which is being made to Firebase.
"""

import asyncio
import collections
import json
Expand Down
27 changes: 15 additions & 12 deletions async_firebase/encoders.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""The module houses encoders needed to properly form the payload.

"""

import typing as t
from copy import deepcopy

Expand All @@ -21,18 +22,20 @@ def aps_encoder(aps: Aps) -> t.Optional[t.Dict[str, t.Any]]:

payload = {
"aps": {
"alert": {
"title": aps.alert.title,
"body": aps.alert.body,
"loc-key": aps.alert.loc_key,
"loc-args": aps.alert.loc_args,
"title-loc-key": aps.alert.title_loc_key,
"title-loc-args": aps.alert.title_loc_args,
"action-loc-key": aps.alert.action_loc_key,
"launch-image": aps.alert.launch_image,
}
if isinstance(aps.alert, ApsAlert)
else aps.alert,
"alert": (
{
"title": aps.alert.title,
"body": aps.alert.body,
"loc-key": aps.alert.loc_key,
"loc-args": aps.alert.loc_args,
"title-loc-key": aps.alert.title_loc_key,
"title-loc-args": aps.alert.title_loc_args,
"action-loc-key": aps.alert.action_loc_key,
"launch-image": aps.alert.launch_image,
}
if isinstance(aps.alert, ApsAlert)
else aps.alert
),
"badge": aps.badge,
"sound": aps.sound,
"category": aps.category,
Expand Down
1 change: 1 addition & 0 deletions async_firebase/errors.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Async Firebase errors."""

import typing as t
from enum import Enum

Expand Down
6 changes: 3 additions & 3 deletions async_firebase/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ class Visibility(IntEnum):
https://developer.android.com/reference/android/app/Notification#visibility
"""

PRIVATE: int = 0
PUBLIC: int = 1
SECRET: int = -1
PRIVATE = 0
PUBLIC = 1
SECRET = -1


@dataclass
Expand Down
14 changes: 7 additions & 7 deletions async_firebase/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,9 @@ def _parse_platform_error(response: httpx.Response):

error_data = data.get("error", {})
if not error_data.get("message"):
error_data[
"message"
] = f"Unexpected HTTP response with status: {response.status_code}; body: {response.content!r}"
error_data["message"] = (
f"Unexpected HTTP response with status: {response.status_code}; body: {response.content!r}"
)
return error_data


Expand Down Expand Up @@ -337,23 +337,23 @@ def _deserialize_batch_response(response: httpx.Response) -> t.List[httpx.Respon

responses = []
for part in mime_response.get_payload():
request_id = part["Content-ID"].split("-", 1)[-1]
status_line, payload = part.get_payload().split("\n", 1)
request_id = part["Content-ID"].split("-", 1)[-1] # type: ignore
status_line, payload = part.get_payload().split("\n", 1) # type: ignore
_, status_code, _ = status_line.split(" ", 2)
status_code = int(status_code)

# Parse the rest of the response
parser = FeedParser()
parser.feed(payload)
msg = parser.close()
msg["status_code"] = status_code
msg["status_code"] = t.cast(str, status_code)

# Create httpx.Response from the parsed headers.
resp = httpx.Response(
status_code=status_code,
headers=httpx.Headers({"Content-Type": msg.get_content_type(), "X-Request-ID": request_id}),
content=msg.get_payload(),
json=json.loads(msg.get_payload()),
json=json.loads(msg.get_payload()), # type: ignore
)
responses.append(resp)

Expand Down
Loading
Loading