Package openid :: Module fetchers
[hide private]
[frames] | no frames]

Module fetchers

source code

This module contains the HTTP fetcher interface and several implementations.

Classes [hide private]
  HTTPResponse
XXX document attributes
  HTTPFetcher
This class is the interface for openid HTTP fetchers.
  HTTPFetchingError
Exception that is wrapped around all exceptions that are raised by the underlying fetcher when using the ExceptionWrappingFetcher
  ExceptionWrappingFetcher
Fetcher that wraps another fetcher, causing all exceptions
  Urllib2Fetcher
An HTTPFetcher that uses urllib2.
  HTTPError
This exception is raised by the CurlHTTPFetcher when it encounters an exceptional situation fetching a URL.
  CurlHTTPFetcher
An HTTPFetcher that uses pycurl for fetching.
  HTTPLib2Fetcher
A fetcher that uses httplib2 for performing HTTP requests.
Functions [hide private]
 
fetch(url, body=None, headers=None)
Invoke the fetch method on the default fetcher.
source code
 
createHTTPFetcher()
Create a default HTTP fetcher instance
source code
HTTPFetcher
getDefaultFetcher()
Return the default fetcher instance if no fetcher has been set, it will create a default fetcher.
source code
 
setDefaultFetcher(fetcher, wrap_exceptions=True)
Set the default fetcher
source code
 
usingCurl()
Whether the currently set HTTP fetcher is a Curl HTTP fetcher.
source code
 
_allowedURL(url) source code
Variables [hide private]
  httplib2 = None
  pycurl = None
  USER_AGENT = "python-openid/%s (%s)" %(openid.__version__, sys...
  MAX_RESPONSE_KB = 1024
  _default_fetcher = None
Function Details [hide private]

fetch(url, body=None, headers=None)

source code 

Invoke the fetch method on the default fetcher. Most users should need only this method.

Raises:
  • Exception - any exceptions that may be raised by the default fetcher

createHTTPFetcher()

source code 

Create a default HTTP fetcher instance

prefers Curl to urllib2.

getDefaultFetcher()

source code 

Return the default fetcher instance if no fetcher has been set, it will create a default fetcher.

Returns: HTTPFetcher
the default fetcher

setDefaultFetcher(fetcher, wrap_exceptions=True)

source code 

Set the default fetcher

Parameters:
  • fetcher (HTTPFetcher) - The fetcher to use as the default HTTP fetcher
  • wrap_exceptions (bool) - Whether to wrap exceptions thrown by the fetcher wil HTTPFetchingError so that they may be caught easier. By default, exceptions will be wrapped. In general, unwrapped fetchers are useful for debugging of fetching errors or if your fetcher raises well-known exceptions that you would like to catch.

Variables Details [hide private]

USER_AGENT

Value:
"python-openid/%s (%s)" %(openid.__version__, sys.platform)