def _request(method, url, content_type=None, _data=None):
 opener = _build_opener(_HTTPHandler)
 request = _Request(url, data=_data)
 if content_type:
  request.add_header('Content-Type', content_type)
 request.get_method = (lambda : method)
 try:
  handler = opener.open(request)
 except HTTPError as exc:
  return {'error': '{0}'.format(exc)}
 return json.loads(handler.read())

def _request ( method , url , content_type = None , _data = None ) : opener = _build_opener ( _HTTPHandler ) request = _Request ( url , data = _data ) if content_type : request . add_header ( 'Content-Type' , content_type ) request . get_method = ( lambda : method ) try : handler = opener . open ( request ) except HTTPError as exc : return { 'error' : '{0}' . format ( exc ) } return json . loads ( handler . read ( ) )
makes a http request .