Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use google-auth-httplib2 explicitly. #62

Merged
merged 2 commits into from
Dec 19, 2017
Merged
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
8 changes: 5 additions & 3 deletions budou/budou.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from . import api, cachefactory
import collections
import google.auth
import google_auth_httplib2
from googleapiclient import discovery
from xml.etree import ElementTree as ET
import html5lib
Expand Down Expand Up @@ -87,7 +88,8 @@ def serialize(self):
'word': self.word,
'pos': self.pos,
'label': self.label,
'dependency': self.dependency
'dependency': self.dependency,
'has_cjk': self.has_cjk(),
}

def maybe_add_dependency(self, default_dependency_direction):
Expand Down Expand Up @@ -187,8 +189,8 @@ def authenticate(cls, json_path=None):
authenticate with default credentials.''')
else:
scoped_credentials, project = google.auth.default(scope)
service = discovery.build(
'language', 'v1beta2', credentials=scoped_credentials)
authed_http = google_auth_httplib2.AuthorizedHttp(scoped_credentials)
service = discovery.build('language', 'v1beta2', http=authed_http)
return cls(service)

def parse(self, source, attributes=None, use_cache=True, language=None,
Expand Down