<s> """<STR_LIT>""" <EOL> __author__ = '<STR_LIT>' <EOL> import StringIO <EOL> USER_AGENT = '<STR_LIT>' <EOL> class Error ( Exception ) : <EOL> pass <EOL> class UnparsableUrlObject ( Error ) : <EOL> pass <EOL> class ContentLengthRequired ( Error ) : <EOL> pass <EOL> class HttpResponse ( object ) : <EOL> def __init__ ( self , body = None , status = None , reason = None , headers = None ) : <EOL> """<STR_LIT>""" <EOL> if body : <EOL> if hasattr ( body , '<STR_LIT>' ) : <EOL> self . _body = body <EOL> else : <EOL> self . _body = StringIO . StringIO ( body ) <EOL> else : <EOL> self . _body = None <EOL> if status is not None : <EOL> self . status = int ( status ) <EOL> else : <EOL> self . status = None <EOL> self . reason = reason <EOL> self . _headers = headers or { } <EOL> def getheader ( self , name , default = None ) : <EOL> if name in self . _headers : <EOL> return self . _headers [ name ] <EOL> else : <EOL> return default <EOL> def read ( self , amt = None ) : <EOL> if not amt : <EOL> return self . _body . read ( ) <EOL> else : <EOL> return self . _body . read ( amt ) <EOL> class GenericHttpClient ( object ) : <EOL> debug = False <EOL> def __init__ ( self , http_client , headers = None ) : <EOL> """<STR_LIT>""" <EOL> self . http_client = http_client <EOL> self . headers = headers or { } <EOL> def request ( self , operation , url , data = None , headers = None ) : <EOL> all_headers = self . headers . copy ( ) <EOL> if headers : <EOL> all_headers . update ( headers ) <EOL> return self . http_client . request ( operation , url , data = data , <EOL> headers = all_headers ) <EOL> def get ( self , url , headers = None ) : <EOL> return self . request ( '<STR_LIT:GET>' , url , headers = headers ) <EOL> def post ( self , url , data , headers = None ) : <EOL> return self . request ( '<STR_LIT:POST>' , url , data = data , headers = headers ) <EOL> def put ( self , url , data , headers = None ) : <EOL> return self . request ( '<STR_LIT>' , url , data = data , headers = headers ) <EOL> def delete ( self , url , headers = None ) : <EOL> return self . request ( '<STR_LIT>' , url , headers = headers ) <EOL> class GenericToken ( object ) : <EOL> """<STR_LIT>""" <EOL> def perform_request ( self , http_client , operation , url , data = None , <EOL> headers = None ) : <EOL> """<STR_LIT>""" <EOL> return http_client . request ( operation , url , data = data , headers = headers ) <EOL> def valid_for_scope ( self , url ) : <EOL> """<STR_LIT>""" <EOL> return False </s>
