def getURL(url, post_data=None, params=None, headers=None, timeout=30, session=None, **kwargs):
 try:
  response_type = kwargs.pop(u'returns', u'text')
  stream = kwargs.pop(u'stream', False)
  (hooks, cookies, verify, proxies) = request_defaults(kwargs)
  if (params and isinstance(params, (list, dict))):
   for param in params:
    if isinstance(params[param], unicode):
     params[param] = params[param].encode(u'utf-8')
  if (post_data and isinstance(post_data, (list, dict))):
   for param in post_data:
    if isinstance(post_data[param], unicode):
     post_data[param] = post_data[param].encode(u'utf-8')
  resp = session.request((u'POST' if post_data else u'GET'), url, data=(post_data or {}), params=(params or {}), timeout=timeout, allow_redirects=True, hooks=hooks, stream=stream, headers=headers, cookies=cookies, proxies=proxies, verify=verify)
  resp.raise_for_status()
 except Exception as error:
  handle_requests_exception(error)
  return None
 try:
  return (resp if ((response_type == u'response') or (response_type is None)) else (resp.json() if (response_type == u'json') else getattr(resp, response_type, resp)))
 except ValueError:
  logger.log(u'Requested a json response but response was not json, check the url: {0}'.format(url), logger.DEBUG)
  return None

def getURL ( url , post_data = None , params = None , headers = None , timeout = 30 , session = None , ** kwargs ) : try : response_type = kwargs . pop ( u'returns' , u'text' ) stream = kwargs . pop ( u'stream' , False ) ( hooks , cookies , verify , proxies ) = request_defaults ( kwargs ) if ( params and isinstance ( params , ( list , dict ) ) ) : for param in params : if isinstance ( params [ param ] , unicode ) : params [ param ] = params [ param ] . encode ( u'utf-8' ) if ( post_data and isinstance ( post_data , ( list , dict ) ) ) : for param in post_data : if isinstance ( post_data [ param ] , unicode ) : post_data [ param ] = post_data [ param ] . encode ( u'utf-8' ) resp = session . request ( ( u'POST' if post_data else u'GET' ) , url , data = ( post_data or { } ) , params = ( params or { } ) , timeout = timeout , allow_redirects = True , hooks = hooks , stream = stream , headers = headers , cookies = cookies , proxies = proxies , verify = verify ) resp . raise_for_status ( ) except Exception as error : handle_requests_exception ( error ) return None try : return ( resp if ( ( response_type == u'response' ) or ( response_type is None ) ) else ( resp . json ( ) if ( response_type == u'json' ) else getattr ( resp , response_type , resp ) ) ) except ValueError : logger . log ( u'Requested a json response but response was not json, check the url: {0}' . format ( url ) , logger . DEBUG ) return None
convenience method to directly retrieve the contents of a url .