#NEWLINE# def plos_search( q , start = 0 , rows = 100 , fl = None , extras = None ) : #NEWLINE# #INDENT# BASE_URL = 'http://api.plos.org/search' #NEWLINE# DEFAULT_FL = ( 'abstract' , 'article_type' , 'author_display' , 'eissn' , 'id' , 'journal' , 'publication_date' , 'score' , 'title_display' ) #NEWLINE# if ( fl is None ) : #NEWLINE# #INDENT# fl_ = ',' . join ( DEFAULT_FL ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# fl_ = ',' . join ( fl ) #NEWLINE# #UNINDENT# query = { #NEWLINE# #INDENT# 'q' : r , #NEWLINE# 'start' : start , #NEWLINE# 'rows' : rows , #NEWLINE# 'api_key' : settings . PLOS_KEY , #NEWLINE# 'wt' : 'json' , #NEWLINE# 'fl' : fl_ , #NEWLINE# 'fq' : 'doc_type:full AND !article_type_facet:"Issue Image"' , #NEWLINE# #UNINDENT# } #NEWLINE# if ( extras is not None ) : #NEWLINE# #INDENT# query . update ( extras ) #NEWLINE# #UNINDENT# query_url = ( ( BASE_URL + '?' ) + urllib . urlencode ( query ) ) #NEWLINE# r = requests . get ( query_url ) #NEWLINE# return r