def tunnel_patch(http):
 request_orig = http.request
 def new_request(uri, method='GET', body=None, headers=None, redirections=httplib2.DEFAULT_MAX_REDIRECTS, connection_type=None):
  'Modify the request headers to add the user-agent.'
  if (headers is None):
   headers = {}
  if (method == 'PATCH'):
   if ('oauth_token' in headers.get('authorization', '')):
    logging.warning('OAuth 1.0 request made with Credentials after tunnel_patch.')
   headers['x-http-method-override'] = 'PATCH'
   method = 'POST'
  (resp, content) = request_orig(uri, method, body, headers, redirections, connection_type)
  return (resp, content)
 http.request = new_request
 return http

def tunnel_patch ( http ) : request_orig = http . request def new_request ( uri , method = 'GET' , body = None , headers = None , redirections = httplib2 . DEFAULT_MAX_REDIRECTS , connection_type = None ) : if ( headers is None ) : headers = { } if ( method == 'PATCH' ) : if ( 'oauth_token' in headers . get ( 'authorization' , '' ) ) : logging . warning ( 'OAuth 1.0 request made with Credentials after tunnel_patch.' ) headers [ 'x-http-method-override' ] = 'PATCH' method = 'POST' ( resp , content ) = request_orig ( uri , method , body , headers , redirections , connection_type ) return ( resp , content ) http . request = new_request return http
tunnel patch requests over post .