#NEWLINE# @ classmethod #NEWLINE# def register_uri( cls , method , uri , body = 'HTTPretty :)' , adding_headers = None , forcing_headers = None , status = 200 , responses = None , match_querystring = False , priority = 0 , **headers ) : #NEWLINE# #INDENT# uri_is_string = isinstance ( uri , basestring ) #NEWLINE# if ( uri_is_string and re . search ( '^\\w+://[^/]+[.]\\w{2,}$' , uri ) ) : #NEWLINE# #INDENT# uri += '/' #NEWLINE# #UNINDENT# if ( isinstance ( responses , list ) and ( len ( responses ) > 0 ) ) : #NEWLINE# #INDENT# for response in responses : #NEWLINE# #INDENT# response . uri = uri #NEWLINE# response . method = method #NEWLINE# #UNINDENT# entries_for_this_uri = responses #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# headers [ str ( 'body' ) ] = body #NEWLINE# headers [ str ( 'adding_headers' ) ] = adding_headers #NEWLINE# headers [ str ( 'forcing_headers' ) ] = forcing_headers #NEWLINE# headers [ str ( 'status' ) ] = status #NEWLINE# entries_for_this_uri = [ cls . Response ( method = method , uri = uri , ** headers ) ] #NEWLINE# #UNINDENT# matcher = URIMatcher ( uri , entries_for_this_uri , match_querystring , responses ) #NEWLINE# if ( matcher in cls . _entries ) : #NEWLINE# #INDENT# matcher . entries . extend ( cls . _entries [ matcher ] ) #NEWLINE# del cls . _entries [ matcher ] #NEWLINE# #UNINDENT# cls . _entries [ matcher ] = entries_for_this_uri