-
-
Save mbrenig/3d007fb8f5f98468a228 to your computer and use it in GitHub Desktop.
Monkey patch gdata.server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BEGIN MONKEY PATCH! | |
# This works around a gdata issue with the 'new-style' google sheets. | |
# Specifically working around this issue: | |
# https://code.google.com/p/gdata-python-client/issues/detail?id=692 | |
# Once api and gdata are fixed this should be removed. | |
import gdata.service | |
oldpp = gdata.service.GDataService.PostOrPut | |
def newpp(self, verb, *args, **kw): | |
if verb == 'PUT' or (verb == 'POST' and | |
type(args[0]).__name__ != 'SpreadsheetsWorksheet'): | |
if not kw.get('extra_headers'): | |
kw['extra_headers'] = { 'If-Match': '*' } | |
else: | |
kw['extra_headers']['If-Match'] = '*' | |
return oldpp(self, verb, *args, **kw) | |
gdata.service.GDataService.PostOrPut = newpp | |
# END MONKEY PATCH! | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment