#NEWLINE# def get_snips_by_tag( self , tag ) : #NEWLINE# #INDENT# '\n        Returns a list of snipt.net snips containing the specified tag\n\n        :param tag: Tag to search\n        :rtype: Dict of snips\n\n        ' #NEWLINE# snips = [ ] #NEWLINE# tag_id = None #NEWLINE# r = requests . get ( ( URL % 'tag/' ) , headers = HEADERS ) #NEWLINE# try : #NEWLINE# #INDENT# data = json . loads ( r . content ) #NEWLINE# objs = data . get ( 'objects' , [ ] ) #NEWLINE# if objs : #NEWLINE# #INDENT# tag_id = [ x . get ( 'id' ) for x in objs if ( x . get ( 'name' ) == tag ) ] [ 0 ] #NEWLINE# #UNINDENT# if tag_id : #NEWLINE# #INDENT# r = requests . get ( ( URL % 'snipt/?tag={0}' . format ( tag_id ) ) , headers = HEADERS ) #NEWLINE# objs = json . loads ( r . content ) . get ( 'objects' ) #NEWLINE# snips = objs #NEWLINE# #UNINDENT# #UNINDENT# except Exception : #NEWLINE# #INDENT# logging . debug ( 'Unable to find snip: {0}' . format ( tag ) ) #NEWLINE# #UNINDENT# return snips