App Engine Python SDK  v1.6.9 rev.445
The Python runtime is available as an experimental Preview feature.
Classes | Functions | Variables
google.appengine.dist27.urllib Namespace Reference

Classes

class  addbase
 
class  addclosehook
 
class  addinfo
 
class  addinfourl
 
class  ContentTooShortError
 
class  FancyURLopener
 
class  ftpwrapper
 
class  URLopener
 

Functions

def url2pathname
 
def pathname2url
 
def urlopen
 
def urlretrieve
 
def urlcleanup
 
def localhost
 
def thishost
 
def ftperrors
 
def noheaders
 
def toBytes
 
def unwrap
 
def splittype
 
def splithost
 
def splituser
 
def splitpasswd
 
def splitport
 
def splitnport
 
def splitquery
 
def splittag
 
def splitattr
 
def splitvalue
 
def unquote
 
def unquote_plus
 
def quote
 
def quote_plus
 
def urlencode
 
def getproxies_environment
 
def proxy_bypass_environment
 
def proxy_bypass_macosx_sysconf
 
def getproxies_macosx_sysconf
 
def proxy_bypass
 
def getproxies
 
def getproxies_registry
 
def proxy_bypass_registry
 
def test1
 
def reporthook
 

Variables

list __all__
 
string __version__ = '1.17'
 
int MAXFTPCACHE = 10
 
 _urlopener = None
 
 _have_ssl = True
 
dictionary ftpcache = {}
 
 _localhost = None
 
 _thishost = None
 
 _ftperrors = None
 
 _noheaders = None
 
 _typeprog = None
 
 _hostprog = None
 
 _userprog = None
 
 _passwdprog = None
 
 _portprog = None
 
 _nportprog = None
 
 _queryprog = None
 
 _tagprog = None
 
 _valueprog = None
 
string _hexdig = '0123456789ABCDEFabcdef'
 
tuple _hextochr
 
tuple always_safe
 
dictionary _safe_map = {}
 
dictionary _safe_quoters = {}
 
 getproxies = getproxies_environment
 
 proxy_bypass = proxy_bypass_environment
 

Detailed Description

Open an arbitrary URL.

See the following document for more info on URLs:
"Names and Addresses, URIs, URLs, URNs, URCs", at
http://www.w3.org/pub/WWW/Addressing/Overview.html

See also the HTTP spec (from which the error codes are derived):
"HTTP - Hypertext Transfer Protocol", at
http://www.w3.org/pub/WWW/Protocols/

Related standards and specs:
- RFC1808: the "relative URL" spec. (authoritative status)
- RFC1738 - the "URL standard". (authoritative status)
- RFC1630 - the "URI spec". (informational status)

The object returned by URLopener().open(file) will differ per
protocol.  All you know is that is has methods read(), readline(),
readlines(), fileno(), close() and info().  The read*(), fileno()
and close() methods work like those of open files.
The info() method returns a mimetools.Message object which can be
used to query various info about the object, if available.
(mimetools.Message objects are queried with the getheader() method.)

Function Documentation

def google.appengine.dist27.urllib.ftperrors ( )
Return the set of errors raised by the FTP class.
def google.appengine.dist27.urllib.getproxies ( )
Return a dictionary of scheme -> proxy server URL mappings.

Returns settings gathered from the environment, if specified,
or the registry.
def google.appengine.dist27.urllib.getproxies_environment ( )
Return a dictionary of scheme -> proxy server URL mappings.

Scan the environment for variables named <scheme>_proxy;
this seems to be the standard convention.  If you need a
different way, you can pass a proxies dictionary to the
[Fancy]URLopener constructor.
def google.appengine.dist27.urllib.getproxies_macosx_sysconf ( )
Return a dictionary of scheme -> proxy server URL mappings.

This function uses the MacOSX framework SystemConfiguration
to fetch the proxy information.
def google.appengine.dist27.urllib.getproxies_registry ( )
Return a dictionary of scheme -> proxy server URL mappings.

Win32 uses the registry to store proxies.
def google.appengine.dist27.urllib.localhost ( )
Return the IP address of the magic hostname 'localhost'.
def google.appengine.dist27.urllib.noheaders ( )
Return an empty mimetools.Message object.
def google.appengine.dist27.urllib.pathname2url (   pathname)
OS-specific conversion from a file system path to a relative URL
of the 'file' scheme; not recommended for general use.
def google.appengine.dist27.urllib.proxy_bypass ( )
Return a dictionary of scheme -> proxy server URL mappings.

Returns settings gathered from the environment, if specified,
or the registry.
def google.appengine.dist27.urllib.proxy_bypass_environment (   host)
Test if proxies should not be used for a particular host.

Checks the environment for a variable named no_proxy, which should
be a list of DNS suffixes separated by commas, or '*' for all hosts.
def google.appengine.dist27.urllib.proxy_bypass_macosx_sysconf (   host)
Return True iff this host shouldn't be accessed using a proxy

This function uses the MacOSX framework SystemConfiguration
to fetch the proxy information.
def google.appengine.dist27.urllib.quote (   s,
  safe = '/' 
)
quote('abc def') -> 'abc%20def'

Each part of a URL, e.g. the path info, the query, etc., has a
different set of reserved characters that must be quoted.

RFC 2396 Uniform Resource Identifiers (URI): Generic Syntax lists
the following reserved characters.

reserved    = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" |
              "$" | ","

Each of these characters is reserved in some component of a URL,
but not necessarily in all of them.

By default, the quote function is intended for quoting the path
section of a URL.  Thus, it will not encode '/'.  This character
is reserved, but in typical usage the quote function is being
called on a path where the existing slash characters are used as
reserved characters.
def google.appengine.dist27.urllib.quote_plus (   s,
  safe = '' 
)
Quote the query fragment of a URL; replacing ' ' with '+'
def google.appengine.dist27.urllib.splitattr (   url)
splitattr('/path;attr1=value1;attr2=value2;...') ->
    '/path', ['attr1=value1', 'attr2=value2', ...].
def google.appengine.dist27.urllib.splithost (   url)
splithost('//host[:port]/path') --> 'host[:port]', '/path'.
def google.appengine.dist27.urllib.splitnport (   host,
  defport = -1 
)
Split host and port, returning numeric port.
Return given default port if no ':' found; defaults to -1.
Return numerical port if a valid number are found after ':'.
Return None if ':' but not a valid number.
def google.appengine.dist27.urllib.splitpasswd (   user)
splitpasswd('user:passwd') -> 'user', 'passwd'.
def google.appengine.dist27.urllib.splitport (   host)
splitport('host:port') --> 'host', 'port'.
def google.appengine.dist27.urllib.splitquery (   url)
splitquery('/path?query') --> '/path', 'query'.
def google.appengine.dist27.urllib.splittag (   url)
splittag('/path#tag') --> '/path', 'tag'.
def google.appengine.dist27.urllib.splittype (   url)
splittype('type:opaquestring') --> 'type', 'opaquestring'.
def google.appengine.dist27.urllib.splituser (   host)
splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.
def google.appengine.dist27.urllib.splitvalue (   attr)
splitvalue('attr=value') --> 'attr', 'value'.
def google.appengine.dist27.urllib.thishost ( )
Return the IP address of the current host.
def google.appengine.dist27.urllib.toBytes (   url)
toBytes(u"URL") --> 'URL'.
def google.appengine.dist27.urllib.unquote (   s)
unquote('abc%20def') -> 'abc def'.
def google.appengine.dist27.urllib.unquote_plus (   s)
unquote('%7e/abc+def') -> '~/abc def'
def google.appengine.dist27.urllib.unwrap (   url)
unwrap('<URL:type://host/path>') --> 'type://host/path'.
def google.appengine.dist27.urllib.url2pathname (   pathname)
OS-specific conversion from a relative URL of the 'file' scheme
to a file system path; not recommended for general use.
def google.appengine.dist27.urllib.urlencode (   query,
  doseq = 0 
)
Encode a sequence of two-element tuples or dictionary into a URL query string.

If any values in the query arg are sequences and doseq is true, each
sequence element is converted to a separate parameter.

If the query arg is a sequence of two-element tuples, the order of the
parameters in the output will match the order of parameters in the
input.
def google.appengine.dist27.urllib.urlopen (   url,
  data = None,
  proxies = None 
)
Create a file-like object for the specified URL to read from.

Variable Documentation

list google.appengine.dist27.urllib.__all__
Initial value:
1 = ["urlopen", "URLopener", "FancyURLopener", "urlretrieve",
2  "urlcleanup", "quote", "quote_plus", "unquote", "unquote_plus",
3  "urlencode", "url2pathname", "pathname2url", "splittag",
4  "localhost", "thishost", "ftperrors", "basejoin", "unwrap",
5  "splittype", "splithost", "splituser", "splitpasswd", "splitport",
6  "splitnport", "splitquery", "splitattr", "splitvalue",
7  "getproxies"]
tuple google.appengine.dist27.urllib._hextochr
Initial value:
1 = dict((a + b, chr(int(a + b, 16)))
2  for a in _hexdig for b in _hexdig)
tuple google.appengine.dist27.urllib.always_safe
Initial value:
1 = ('ABCDEFGHIJKLMNOPQRSTUVWXYZ'
2  'abcdefghijklmnopqrstuvwxyz'
3  '0123456789' '_.-')
def google.appengine.dist27.urllib.getproxies = getproxies_environment
Return a dictionary of scheme -> proxy server URL mappings.

Returns settings gathered from the environment, if specified,
or the registry.
def google.appengine.dist27.urllib.proxy_bypass = proxy_bypass_environment
Return a dictionary of scheme -> proxy server URL mappings.

Returns settings gathered from the environment, if specified,
or the registry.