Skip to content

Commit 32f74bf

Browse files
authored
Merge branch 'master' into auth-add-provider
2 parents 2705ca1 + 70013c8 commit 32f74bf

21 files changed

+1892
-31
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ requests, code review feedback, and also pull requests.
4343

4444
## Supported Python Versions
4545

46-
We currently support Python 3.7+. However, Python 3.7 support is deprecated,
47-
and developers are strongly advised to use Python 3.8 or higher. Firebase
46+
We currently support Python 3.7+. However, Python 3.7 and Python 3.8 support is deprecated,
47+
and developers are strongly advised to use Python 3.9 or higher. Firebase
4848
Admin Python SDK is also tested on PyPy and
4949
[Google App Engine](https://cloud.google.com/appengine/) environments.
5050

firebase_admin/__about__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
"""About information (version, etc) for Firebase Admin SDK."""
1616

17-
__version__ = '6.6.0'
17+
__version__ = '6.8.0'
1818
__title__ = 'firebase_admin'
1919
__author__ = 'Firebase'
2020
__license__ = 'Apache License 2.0'

firebase_admin/_http_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
DEFAULT_TIMEOUT_SECONDS = 120
3939

4040
METRICS_HEADERS = {
41-
'X-GOOG-API-CLIENT': _utils.get_metrics_header(),
41+
'x-goog-api-client': _utils.get_metrics_header(),
4242
}
4343

4444
class HttpClient:
@@ -76,7 +76,6 @@ def __init__(
7676

7777
if headers:
7878
self._session.headers.update(headers)
79-
self._session.headers.update(METRICS_HEADERS)
8079
if retries:
8180
self._session.mount('http://', requests.adapters.HTTPAdapter(max_retries=retries))
8281
self._session.mount('https://', requests.adapters.HTTPAdapter(max_retries=retries))
@@ -120,6 +119,7 @@ class call this method to send HTTP requests out. Refer to
120119
"""
121120
if 'timeout' not in kwargs:
122121
kwargs['timeout'] = self.timeout
122+
kwargs.setdefault('headers', {}).update(METRICS_HEADERS)
123123
resp = self._session.request(method, self.base_url + url, **kwargs)
124124
resp.raise_for_status()
125125
return resp

firebase_admin/_messaging_encoder.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,9 @@ def encode_android_notification(cls, notification):
319319
'visibility': _Validators.check_string(
320320
'AndroidNotification.visibility', notification.visibility, non_empty=True),
321321
'notification_count': _Validators.check_number(
322-
'AndroidNotification.notification_count', notification.notification_count)
322+
'AndroidNotification.notification_count', notification.notification_count),
323+
'proxy': _Validators.check_string(
324+
'AndroidNotification.proxy', notification.proxy, non_empty=True)
323325
}
324326
result = cls.remove_null_values(result)
325327
color = result.get('color')
@@ -363,6 +365,13 @@ def encode_android_notification(cls, notification):
363365
'AndroidNotification.vibrate_timings_millis', msec)
364366
vibrate_timing_strings.append(formated_string)
365367
result['vibrate_timings'] = vibrate_timing_strings
368+
369+
proxy = result.get('proxy')
370+
if proxy:
371+
if proxy not in ('allow', 'deny', 'if_priority_lowered'):
372+
raise ValueError(
373+
'AndroidNotification.proxy must be "allow", "deny" or "if_priority_lowered".')
374+
result['proxy'] = proxy.upper()
366375
return result
367376

368377
@classmethod

firebase_admin/_messaging_utils.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,14 +137,18 @@ class AndroidNotification:
137137
If ``default_light_settings`` is set to ``True`` and ``light_settings`` is also set, the
138138
user-specified ``light_settings`` is used instead of the default value.
139139
visibility: Sets the visibility of the notification. Must be either ``private``, ``public``,
140-
or ``secret``. If unspecified, default to ``private``.
140+
or ``secret``. If unspecified, it remains undefined in the Admin SDK, and defers to
141+
the FCM backend's default mapping.
141142
notification_count: Sets the number of items this notification represents. May be displayed
142143
as a badge count for Launchers that support badging. See ``NotificationBadge``
143144
https://developer.android.com/training/notify-user/badges. For example, this might be
144145
useful if you're using just one notification to represent multiple new messages but you
145146
want the count here to represent the number of total new messages. If zero or
146147
unspecified, systems that support badging use the default, which is to increment a
147148
number displayed on the long-press menu each time a new notification arrives.
149+
proxy: Sets if the notification may be proxied. Must be one of ``allow``, ``deny``, or
150+
``if_priority_lowered``. If unspecified, it remains undefined in the Admin SDK, and
151+
defers to the FCM backend's default mapping.
148152
149153
150154
"""
@@ -154,7 +158,8 @@ def __init__(self, title=None, body=None, icon=None, color=None, sound=None, tag
154158
title_loc_args=None, channel_id=None, image=None, ticker=None, sticky=None,
155159
event_timestamp=None, local_only=None, priority=None, vibrate_timings_millis=None,
156160
default_vibrate_timings=None, default_sound=None, light_settings=None,
157-
default_light_settings=None, visibility=None, notification_count=None):
161+
default_light_settings=None, visibility=None, notification_count=None,
162+
proxy=None):
158163
self.title = title
159164
self.body = body
160165
self.icon = icon
@@ -180,6 +185,7 @@ def __init__(self, title=None, body=None, icon=None, color=None, sound=None, tag
180185
self.default_light_settings = default_light_settings
181186
self.visibility = visibility
182187
self.notification_count = notification_count
188+
self.proxy = proxy
183189

184190

185191
class LightSettings:

firebase_admin/app_check.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class _AppCheckService:
5252
_jwks_client = None
5353

5454
_APP_CHECK_HEADERS = {
55-
'X-GOOG-API-CLIENT': _utils.get_metrics_header(),
55+
'x-goog-api-client': _utils.get_metrics_header(),
5656
}
5757

5858
def __init__(self, app):

0 commit comments

Comments
 (0)