From 774b64cf1ce240b3fd5040f8b1ad6dd4b8994060 Mon Sep 17 00:00:00 2001 From: Shuhei Iitsuka Date: Tue, 19 Dec 2017 14:16:55 +0900 Subject: [PATCH 1/2] Use google-auth-httplib2 explicitly. --- budou/budou.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/budou/budou.py b/budou/budou.py index a5bee1e..1e5ef47 100644 --- a/budou/budou.py +++ b/budou/budou.py @@ -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 @@ -187,8 +188,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, From eaad1f26eec7d32929aa43deecb0450c31a439e2 Mon Sep 17 00:00:00 2001 From: Shuhei Iitsuka Date: Tue, 19 Dec 2017 14:21:10 +0900 Subject: [PATCH 2/2] Add has_cjk property in serialized Chunk. --- budou/budou.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/budou/budou.py b/budou/budou.py index 1e5ef47..2b84bf8 100644 --- a/budou/budou.py +++ b/budou/budou.py @@ -88,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):