tvl-depot/third_party/lieer/discovery_doc.patch
Vincent Ambo 8b58593193 fix(3p/lieer): Work around issues in Google Mail API
There is a temporary issue affecting the retrieval of discovery
documents in the Google Mail API:
https://issuetracker.google.com/issues/160441983

It's possible to work around this by hardcoding the document instead
of retrieving it over the network, as all other API calls still work
as they should.

This does exactly that by generating a patch to apply to lieer, from
the file checked in to the depot with this commit.

This workaround should be reverted once Google has fixed the issue
upstream.

Change-Id: I0063d0bc67753ffa5261c2aa059c7bfd09136ba0
Reviewed-on: https://cl.tvl.fyi/c/depot/+/945
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
2020-07-06 21:35:30 +00:00

15 lines
577 B
Diff

diff --git a/lieer/remote.py b/lieer/remote.py
index 6e3973a..2b0b59e 100644
--- a/lieer/remote.py
+++ b/lieer/remote.py
@@ -386,7 +386,9 @@ class Remote:
if timeout == 0: timeout = None
self.http = self.credentials.authorize (httplib2.Http(timeout = timeout))
- self.service = discovery.build ('gmail', 'v1', http = self.http)
+ with open('${DISCOVERY_DOC}', 'r') as file:
+ discovery_doc = file.read()
+ self.service = discovery.build_from_document(discovery_doc, http = self.http)
self.authorized = True
def __get_credentials__ (self):