Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8312d29

Browse filesBrowse files
committed
Fix for pubsub scope error.
1 parent f8e499a commit 8312d29
Copy full SHA for 8312d29

File tree

Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-0
lines changed
Open diff view settings
Collapse file

‎pubsub/google/cloud/pubsub/client.py‎

Copy file name to clipboardExpand all lines: pubsub/google/cloud/pubsub/client.py
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
import os
1818

19+
import google.auth.credentials
1920
from google.cloud.client import JSONClient
2021
from google.cloud.environment_vars import DISABLE_GRPC
2122
from google.cloud.pubsub._http import Connection
@@ -42,6 +43,9 @@
4243
_DISABLE_GAX = os.getenv(DISABLE_GRPC, False)
4344
_USE_GAX = _HAVE_GAX and not _DISABLE_GAX
4445

46+
_SCOPES = ('https://www.googleapis.com/auth/pubsub',
47+
'https://www.googleapis.com/auth/cloud-platform')
48+
4549

4650
class Client(JSONClient):
4751
"""Client to bundle configuration needed for API requests.
@@ -79,6 +83,8 @@ def __init__(self, project=None, credentials=None,
7983
http=None, use_gax=None):
8084
super(Client, self).__init__(
8185
project=project, credentials=credentials, http=http)
86+
self._credentials = google.auth.credentials.with_scopes_if_required(
87+
self._credentials, _SCOPES)
8288
self._connection = Connection(
8389
credentials=self._credentials, http=self._http)
8490
if use_gax is None:

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.