Namespaces | Functions
samweb_client Namespace Reference

Namespaces

 _exceptions
 
 _version
 
 admin
 
 client
 
 definitions
 
 exceptions
 
 files
 
 http_client
 
 http_client_requests
 
 http_client_urllib2
 
 misc
 
 projects
 
 utility
 

Functions

def convert_from_unicode (input)
 

Function Documentation

def samweb_client.convert_from_unicode (   input)
convert an object structure (specifically those returned via json
to use plain strings insead of unicode 

Definition at line 14 of file __init__.py.

Referenced by samweb_client.definitions.descDefinitionDict(), samweb_client.admin.describeUser(), samweb_client.files.getAvailableDimensions(), samweb_client.admin.getAvailableValues(), samweb_client.files.getFileAccessUrls(), samweb_client.files.getFileLineage(), samweb_client.files.getMetadata(), samweb_client.files.getMultipleMetadata(), samweb_client.admin.listApplications(), samweb_client.admin.listDataDisks(), samweb_client.files.listFilesSummary(), samweb_client.admin.listParameters(), samweb_client.admin.listParameterValues(), samweb_client.admin.listUsers(), samweb_client.admin.listValues(), samweb_client.files.locateFile(), samweb_client.files.locateFiles(), samweb_client.projects.projectRecoveryDimension(), and samweb_client.projects.projectSummary().

15  """ convert an object structure (specifically those returned via json
16  to use plain strings insead of unicode """
17  if isinstance(input, dict):
18  return type(input)( (convert_from_unicode(key), convert_from_unicode(value)) for key, value in input.iteritems())
19  elif isinstance(input, list):
20  return [convert_from_unicode(element) for element in input]
21  elif isinstance(input, unicode):
22  try:
23  return input.encode('ascii')
24  except UnicodeEncodeError:
25  # can't be represented as ascii; leave it as unicode
26  return input
27  else:
28  return input
29 
::xsd::cxx::tree::type type
Definition: Database.h:110
def convert_from_unicode(input)
Definition: __init__.py:14