proxygen
upload.HttpRpcServer Class Reference

elif e.code >= 500 and e.code < 600:

Server Error - try again.

More...

Inheritance diagram for upload.HttpRpcServer:
upload.AbstractRpcServer upload.AbstractRpcServer upload.AbstractRpcServer upload.AbstractRpcServer upload.AbstractRpcServer upload.AbstractRpcServer

Public Attributes

 cookie_file
 
 cookie_jar
 
 authenticated
 
- Public Attributes inherited from upload.AbstractRpcServer
 host
 
 host_override
 
 auth_function
 
 authenticated
 
 extra_headers
 
 save_cookies
 
 opener
 

Private Member Functions

def _Authenticate (self)
 
def _GetOpener (self)
 
def _Authenticate (self)
 
def _GetOpener (self)
 
def _Authenticate (self)
 
def _GetOpener (self)
 
def _Authenticate (self)
 
def _GetOpener (self)
 
def _Authenticate (self)
 
def _GetOpener (self)
 
def _Authenticate (self)
 
def _GetOpener (self)
 

Additional Inherited Members

- Public Member Functions inherited from upload.AbstractRpcServer
def __init__ (self, host, auth_function, host_override=None, extra_headers={}, save_cookies=False)
 
def Send (self, request_path, payload=None, content_type="application/octet-stream", timeout=None, kwargs)
 
def __init__ (self, host, auth_function, host_override=None, extra_headers={}, save_cookies=False)
 
def Send (self, request_path, payload=None, content_type="application/octet-stream", timeout=None, kwargs)
 
def __init__ (self, host, auth_function, host_override=None, extra_headers={}, save_cookies=False)
 
def Send (self, request_path, payload=None, content_type="application/octet-stream", timeout=None, kwargs)
 
def __init__ (self, host, auth_function, host_override=None, extra_headers={}, save_cookies=False)
 
def Send (self, request_path, payload=None, content_type="application/octet-stream", timeout=None, kwargs)
 
def __init__ (self, host, auth_function, host_override=None, extra_headers={}, save_cookies=False)
 
def Send (self, request_path, payload=None, content_type="application/octet-stream", timeout=None, kwargs)
 
def __init__ (self, host, auth_function, host_override=None, extra_headers={}, save_cookies=False)
 
def Send (self, request_path, payload=None, content_type="application/octet-stream", timeout=None, kwargs)
 

Detailed Description

elif e.code >= 500 and e.code < 600:

Server Error - try again.

continue

Provides a simplified RPC-style interface for HTTP requests.

Definition at line 344 of file upload.py.

Member Function Documentation

def upload.HttpRpcServer._Authenticate (   self)
private
Save the cookie jar after authentication.

Definition at line 347 of file upload.py.

References upload.HttpRpcServer.cookie_file, upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

Referenced by upload.HttpRpcServer._Authenticate().

347  def _Authenticate(self):
348  """Save the cookie jar after authentication."""
349  super(HttpRpcServer, self)._Authenticate()
350  if self.save_cookies:
351  StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
352  self.cookie_jar.save()
353 
def StatusUpdate(msg)
Definition: upload.py:97
def _Authenticate(self)
Definition: upload.py:347
def upload.HttpRpcServer._Authenticate (   self)
private
Save the cookie jar after authentication.

Definition at line 347 of file upload.py.

References upload.HttpRpcServer._Authenticate(), upload.HttpRpcServer.cookie_file, upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

347  def _Authenticate(self):
348  """Save the cookie jar after authentication."""
349  super(HttpRpcServer, self)._Authenticate()
350  if self.save_cookies:
351  StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
352  self.cookie_jar.save()
353 
def StatusUpdate(msg)
Definition: upload.py:97
def _Authenticate(self)
Definition: upload.py:347
def upload.HttpRpcServer._Authenticate (   self)
private
Save the cookie jar after authentication.

Definition at line 347 of file upload.py.

References upload.HttpRpcServer._Authenticate(), upload.HttpRpcServer.cookie_file, upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

347  def _Authenticate(self):
348  """Save the cookie jar after authentication."""
349  super(HttpRpcServer, self)._Authenticate()
350  if self.save_cookies:
351  StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
352  self.cookie_jar.save()
353 
def StatusUpdate(msg)
Definition: upload.py:97
def _Authenticate(self)
Definition: upload.py:347
def upload.HttpRpcServer._Authenticate (   self)
private
Save the cookie jar after authentication.

Definition at line 347 of file upload.py.

References upload.HttpRpcServer._Authenticate(), upload.HttpRpcServer.cookie_file, upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

347  def _Authenticate(self):
348  """Save the cookie jar after authentication."""
349  super(HttpRpcServer, self)._Authenticate()
350  if self.save_cookies:
351  StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
352  self.cookie_jar.save()
353 
def StatusUpdate(msg)
Definition: upload.py:97
def _Authenticate(self)
Definition: upload.py:347
def upload.HttpRpcServer._Authenticate (   self)
private
Save the cookie jar after authentication.

Definition at line 347 of file upload.py.

References upload.HttpRpcServer._Authenticate(), upload.HttpRpcServer.cookie_file, upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

347  def _Authenticate(self):
348  """Save the cookie jar after authentication."""
349  super(HttpRpcServer, self)._Authenticate()
350  if self.save_cookies:
351  StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
352  self.cookie_jar.save()
353 
def StatusUpdate(msg)
Definition: upload.py:97
def _Authenticate(self)
Definition: upload.py:347
def upload.HttpRpcServer._Authenticate (   self)
private
Save the cookie jar after authentication.

Definition at line 347 of file upload.py.

References upload.HttpRpcServer._Authenticate(), upload.HttpRpcServer.cookie_file, upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

347  def _Authenticate(self):
348  """Save the cookie jar after authentication."""
349  super(HttpRpcServer, self)._Authenticate()
350  if self.save_cookies:
351  StatusUpdate("Saving authentication cookies to %s" % self.cookie_file)
352  self.cookie_jar.save()
353 
def StatusUpdate(msg)
Definition: upload.py:97
def _Authenticate(self)
Definition: upload.py:347
def upload.HttpRpcServer._GetOpener (   self)
private
Returns an OpenerDirector that supports cookies and ignores redirects.

Returns:
  A urllib2.OpenerDirector object.

Definition at line 354 of file upload.py.

References upload.HttpRpcServer._GetOpener(), upload.AbstractRpcServer.authenticated, upload.HttpRpcServer.cookie_file, upload.HttpRpcServer.cookie_jar, upload.EncodeMultipartFormData(), upload.ErrorExit(), upload.GetContentType(), upload.GetEmail(), upload.GetRpcServer(), join, object, upload.RunShell(), upload.RunShellWithReturnCode(), upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

354  def _GetOpener(self):
355  """Returns an OpenerDirector that supports cookies and ignores redirects.
356 
357  Returns:
358  A urllib2.OpenerDirector object.
359  """
360  opener = urllib2.OpenerDirector()
361  opener.add_handler(urllib2.ProxyHandler())
362  opener.add_handler(urllib2.UnknownHandler())
363  opener.add_handler(urllib2.HTTPHandler())
364  opener.add_handler(urllib2.HTTPDefaultErrorHandler())
365  opener.add_handler(urllib2.HTTPSHandler())
366  opener.add_handler(urllib2.HTTPErrorProcessor())
367  if self.save_cookies:
368  self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies")
369  self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file)
370  if os.path.exists(self.cookie_file):
371  try:
372  self.cookie_jar.load()
373  self.authenticated = True
374  StatusUpdate("Loaded authentication cookies from %s" %
375  self.cookie_file)
376  except (cookielib.LoadError, IOError):
377  # Failed to load cookies - just ignore them.
378  pass
379  else:
380  # Create an empty cookie file with mode 600
381  fd = os.open(self.cookie_file, os.O_CREAT, 0600)
382  os.close(fd)
383  # Always chmod the cookie file
384  os.chmod(self.cookie_file, 0600)
385  else:
386  # Don't save cookies across runs of update.py.
387  self.cookie_jar = cookielib.CookieJar()
388  opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar))
389  return opener
390 
391 
def _GetOpener(self)
Definition: upload.py:354
def StatusUpdate(msg)
Definition: upload.py:97
def upload.HttpRpcServer._GetOpener (   self)
private
Returns an OpenerDirector that supports cookies and ignores redirects.

Returns:
  A urllib2.OpenerDirector object.

Definition at line 354 of file upload.py.

References upload.HttpRpcServer._GetOpener(), upload.AbstractRpcServer.authenticated, upload.HttpRpcServer.cookie_file, upload.HttpRpcServer.cookie_jar, upload.EncodeMultipartFormData(), upload.ErrorExit(), upload.GetContentType(), upload.GetEmail(), upload.GetRpcServer(), join, object, upload.RunShell(), upload.RunShellWithReturnCode(), upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

354  def _GetOpener(self):
355  """Returns an OpenerDirector that supports cookies and ignores redirects.
356 
357  Returns:
358  A urllib2.OpenerDirector object.
359  """
360  opener = urllib2.OpenerDirector()
361  opener.add_handler(urllib2.ProxyHandler())
362  opener.add_handler(urllib2.UnknownHandler())
363  opener.add_handler(urllib2.HTTPHandler())
364  opener.add_handler(urllib2.HTTPDefaultErrorHandler())
365  opener.add_handler(urllib2.HTTPSHandler())
366  opener.add_handler(urllib2.HTTPErrorProcessor())
367  if self.save_cookies:
368  self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies")
369  self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file)
370  if os.path.exists(self.cookie_file):
371  try:
372  self.cookie_jar.load()
373  self.authenticated = True
374  StatusUpdate("Loaded authentication cookies from %s" %
375  self.cookie_file)
376  except (cookielib.LoadError, IOError):
377  # Failed to load cookies - just ignore them.
378  pass
379  else:
380  # Create an empty cookie file with mode 600
381  fd = os.open(self.cookie_file, os.O_CREAT, 0600)
382  os.close(fd)
383  # Always chmod the cookie file
384  os.chmod(self.cookie_file, 0600)
385  else:
386  # Don't save cookies across runs of update.py.
387  self.cookie_jar = cookielib.CookieJar()
388  opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar))
389  return opener
390 
391 
def _GetOpener(self)
Definition: upload.py:354
def StatusUpdate(msg)
Definition: upload.py:97
def upload.HttpRpcServer._GetOpener (   self)
private
Returns an OpenerDirector that supports cookies and ignores redirects.

Returns:
  A urllib2.OpenerDirector object.

Definition at line 354 of file upload.py.

References upload.AbstractRpcServer.save_cookies.

Referenced by upload.HttpRpcServer._GetOpener().

354  def _GetOpener(self):
355  """Returns an OpenerDirector that supports cookies and ignores redirects.
356 
357  Returns:
358  A urllib2.OpenerDirector object.
359  """
360  opener = urllib2.OpenerDirector()
361  opener.add_handler(urllib2.ProxyHandler())
362  opener.add_handler(urllib2.UnknownHandler())
363  opener.add_handler(urllib2.HTTPHandler())
364  opener.add_handler(urllib2.HTTPDefaultErrorHandler())
365  opener.add_handler(urllib2.HTTPSHandler())
366  opener.add_handler(urllib2.HTTPErrorProcessor())
367  if self.save_cookies:
368  self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies")
369  self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file)
370  if os.path.exists(self.cookie_file):
371  try:
372  self.cookie_jar.load()
373  self.authenticated = True
374  StatusUpdate("Loaded authentication cookies from %s" %
375  self.cookie_file)
376  except (cookielib.LoadError, IOError):
377  # Failed to load cookies - just ignore them.
378  pass
379  else:
380  # Create an empty cookie file with mode 600
381  fd = os.open(self.cookie_file, os.O_CREAT, 0600)
382  os.close(fd)
383  # Always chmod the cookie file
384  os.chmod(self.cookie_file, 0600)
385  else:
386  # Don't save cookies across runs of update.py.
387  self.cookie_jar = cookielib.CookieJar()
388  opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar))
389  return opener
390 
391 
def _GetOpener(self)
Definition: upload.py:354
def StatusUpdate(msg)
Definition: upload.py:97
def upload.HttpRpcServer._GetOpener (   self)
private
Returns an OpenerDirector that supports cookies and ignores redirects.

Returns:
  A urllib2.OpenerDirector object.

Definition at line 354 of file upload.py.

References upload.HttpRpcServer._GetOpener(), upload.AbstractRpcServer.authenticated, upload.HttpRpcServer.cookie_file, upload.HttpRpcServer.cookie_jar, upload.EncodeMultipartFormData(), upload.ErrorExit(), upload.GetContentType(), upload.GetEmail(), upload.GetRpcServer(), join, object, upload.RunShell(), upload.RunShellWithReturnCode(), upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

354  def _GetOpener(self):
355  """Returns an OpenerDirector that supports cookies and ignores redirects.
356 
357  Returns:
358  A urllib2.OpenerDirector object.
359  """
360  opener = urllib2.OpenerDirector()
361  opener.add_handler(urllib2.ProxyHandler())
362  opener.add_handler(urllib2.UnknownHandler())
363  opener.add_handler(urllib2.HTTPHandler())
364  opener.add_handler(urllib2.HTTPDefaultErrorHandler())
365  opener.add_handler(urllib2.HTTPSHandler())
366  opener.add_handler(urllib2.HTTPErrorProcessor())
367  if self.save_cookies:
368  self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies")
369  self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file)
370  if os.path.exists(self.cookie_file):
371  try:
372  self.cookie_jar.load()
373  self.authenticated = True
374  StatusUpdate("Loaded authentication cookies from %s" %
375  self.cookie_file)
376  except (cookielib.LoadError, IOError):
377  # Failed to load cookies - just ignore them.
378  pass
379  else:
380  # Create an empty cookie file with mode 600
381  fd = os.open(self.cookie_file, os.O_CREAT, 0600)
382  os.close(fd)
383  # Always chmod the cookie file
384  os.chmod(self.cookie_file, 0600)
385  else:
386  # Don't save cookies across runs of update.py.
387  self.cookie_jar = cookielib.CookieJar()
388  opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar))
389  return opener
390 
391 
def _GetOpener(self)
Definition: upload.py:354
def StatusUpdate(msg)
Definition: upload.py:97
def upload.HttpRpcServer._GetOpener (   self)
private
Returns an OpenerDirector that supports cookies and ignores redirects.

Returns:
  A urllib2.OpenerDirector object.

Definition at line 354 of file upload.py.

References upload.HttpRpcServer._GetOpener(), upload.AbstractRpcServer.authenticated, upload.HttpRpcServer.cookie_file, upload.HttpRpcServer.cookie_jar, upload.EncodeMultipartFormData(), upload.ErrorExit(), upload.GetContentType(), upload.GetEmail(), upload.GetRpcServer(), join, object, upload.RunShell(), upload.RunShellWithReturnCode(), upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

354  def _GetOpener(self):
355  """Returns an OpenerDirector that supports cookies and ignores redirects.
356 
357  Returns:
358  A urllib2.OpenerDirector object.
359  """
360  opener = urllib2.OpenerDirector()
361  opener.add_handler(urllib2.ProxyHandler())
362  opener.add_handler(urllib2.UnknownHandler())
363  opener.add_handler(urllib2.HTTPHandler())
364  opener.add_handler(urllib2.HTTPDefaultErrorHandler())
365  opener.add_handler(urllib2.HTTPSHandler())
366  opener.add_handler(urllib2.HTTPErrorProcessor())
367  if self.save_cookies:
368  self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies")
369  self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file)
370  if os.path.exists(self.cookie_file):
371  try:
372  self.cookie_jar.load()
373  self.authenticated = True
374  StatusUpdate("Loaded authentication cookies from %s" %
375  self.cookie_file)
376  except (cookielib.LoadError, IOError):
377  # Failed to load cookies - just ignore them.
378  pass
379  else:
380  # Create an empty cookie file with mode 600
381  fd = os.open(self.cookie_file, os.O_CREAT, 0600)
382  os.close(fd)
383  # Always chmod the cookie file
384  os.chmod(self.cookie_file, 0600)
385  else:
386  # Don't save cookies across runs of update.py.
387  self.cookie_jar = cookielib.CookieJar()
388  opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar))
389  return opener
390 
391 
def _GetOpener(self)
Definition: upload.py:354
def StatusUpdate(msg)
Definition: upload.py:97
def upload.HttpRpcServer._GetOpener (   self)
private
Returns an OpenerDirector that supports cookies and ignores redirects.

Returns:
  A urllib2.OpenerDirector object.

Definition at line 354 of file upload.py.

References upload.HttpRpcServer._GetOpener(), upload.AbstractRpcServer.authenticated, upload.HttpRpcServer.cookie_file, upload.HttpRpcServer.cookie_jar, upload.EncodeMultipartFormData(), upload.ErrorExit(), upload.GetContentType(), upload.GetEmail(), upload.GetRpcServer(), join, object, upload.RunShell(), upload.RunShellWithReturnCode(), upload.AbstractRpcServer.save_cookies, and upload.StatusUpdate().

354  def _GetOpener(self):
355  """Returns an OpenerDirector that supports cookies and ignores redirects.
356 
357  Returns:
358  A urllib2.OpenerDirector object.
359  """
360  opener = urllib2.OpenerDirector()
361  opener.add_handler(urllib2.ProxyHandler())
362  opener.add_handler(urllib2.UnknownHandler())
363  opener.add_handler(urllib2.HTTPHandler())
364  opener.add_handler(urllib2.HTTPDefaultErrorHandler())
365  opener.add_handler(urllib2.HTTPSHandler())
366  opener.add_handler(urllib2.HTTPErrorProcessor())
367  if self.save_cookies:
368  self.cookie_file = os.path.expanduser("~/.codereview_upload_cookies")
369  self.cookie_jar = cookielib.MozillaCookieJar(self.cookie_file)
370  if os.path.exists(self.cookie_file):
371  try:
372  self.cookie_jar.load()
373  self.authenticated = True
374  StatusUpdate("Loaded authentication cookies from %s" %
375  self.cookie_file)
376  except (cookielib.LoadError, IOError):
377  # Failed to load cookies - just ignore them.
378  pass
379  else:
380  # Create an empty cookie file with mode 600
381  fd = os.open(self.cookie_file, os.O_CREAT, 0600)
382  os.close(fd)
383  # Always chmod the cookie file
384  os.chmod(self.cookie_file, 0600)
385  else:
386  # Don't save cookies across runs of update.py.
387  self.cookie_jar = cookielib.CookieJar()
388  opener.add_handler(urllib2.HTTPCookieProcessor(self.cookie_jar))
389  return opener
390 
391 
def _GetOpener(self)
Definition: upload.py:354
def StatusUpdate(msg)
Definition: upload.py:97

Member Data Documentation

upload.HttpRpcServer.authenticated

Definition at line 373 of file upload.py.

upload.HttpRpcServer.cookie_file
upload.HttpRpcServer.cookie_jar

Definition at line 369 of file upload.py.

Referenced by upload.HttpRpcServer._GetOpener().


The documentation for this class was generated from the following file: