Package cm_api :: Module http_client
[hide private]
[frames] | no frames]

Module http_client

source code

Classes [hide private]
  RestException
Any error result from the Rest API is converted into this exception type.
  HttpClient
Basic HTTP client tailored for rest APIs.
  HTTPErrorProcessor
Python 2.4 only recognize 200 and 206 as success.
Functions [hide private]
 
iri_to_uri(iri)
Convert an Internationalized Resource Identifier (IRI) portion to a URI portion that is suitable for inclusion in a URL.
source code
 
smart_str(s, encoding='utf-8', strings_only=False, errors='strict')
Returns a bytestring version of 's', encoded as specified in 'encoding'.
source code
Variables [hide private]
  socks_server = os.environ.get("SOCKS_SERVER", None)
  LOG = logging.getLogger(__name__)
  __package__ = 'cm_api'
Function Details [hide private]

iri_to_uri(iri)

source code 

Convert an Internationalized Resource Identifier (IRI) portion to a URI portion that is suitable for inclusion in a URL.

This is the algorithm from section 3.1 of RFC 3987. However, since we are assuming input is either UTF-8 or unicode already, we can simplify things a little from the full method.

Returns an ASCII string containing the encoded result.

smart_str(s, encoding='utf-8', strings_only=False, errors='strict')

source code 

Returns a bytestring version of 's', encoded as specified in 'encoding'.

If strings_only is True, don't convert (some) non-string-like objects.