Package openid :: Module fetchers
[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
  HTTPError
This exception is raised by the CurlHTTPFetcher when it encounters an exceptional situation fetching a URL.

Functions [hide private]
  fetch(url, body=None, headers=None)
Invoke the fetch method on the default fetcher.
  createHTTPFetcher()
Create a default HTTP fetcher instance
HTTPFetcher getDefaultFetcher()
Return the default fetcher instance if no fetcher has been set, it will create a default fetcher.
  setDefaultFetcher(fetcher, wrap_exceptions=True)
Set the default fetcher

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.