@@ -51,11 +51,15 @@ def set_logger(self, enable: bool):
5151 """
5252 self .__nav .set_logger (enable )
5353
54+ def set_timeout (self , timeout : int ):
55+ """Set timeout period in seconds for scholarly"""
56+ self .__nav .set_timeout (timeout )
57+
5458
5559 def search_pubs (self ,
5660 query : str , patents : bool = True ,
5761 citations : bool = True , year_low : int = None ,
58- year_high : int = None )-> _SearchScholarIterator :
62+ year_high : int = None , sortby_date : str = None )-> _SearchScholarIterator :
5963 """Searches by query and returns a generator of Publication objects
6064
6165 :param query: terms to be searched
@@ -68,6 +72,8 @@ def search_pubs(self,
6872 :type year_low: int, optional
6973 :param year_high: maximum year of publication, defaults to None
7074 :type year_high: int, optional
75+ :param sortby_date: 'abstracts' for abstracts, 'everything' for all results
76+ :type sortyby_date: string, optional
7177 :returns: Generator of Publication objects
7278 :rtype: Iterator[:class:`Publication`]
7379
@@ -116,8 +122,14 @@ def search_pubs(self,
116122 yr_hi = '&as_yhi={0}' .format (year_high ) if year_high is not None else ''
117123 citations = '&as_vis={0}' .format (1 - int (citations ))
118124 patents = '&as_sdt={0},33' .format (1 - int (patents ))
125+ sortby = ''
126+
127+ if sortby_date == 'abstract' :
128+ sortby = '&scisbd=1'
129+ elif sortby_date == 'everything' :
130+ sortby = '&scisbd=2'
119131 # improve str below
120- url = url + yr_lo + yr_hi + citations + patents
132+ url = url + yr_lo + yr_hi + citations + patents + sortby
121133 return self .__nav .search_publications (url )
122134
123135 def search_single_pub (self , pub_title : str , filled : bool = False )-> PublicationParser :
@@ -317,3 +329,20 @@ def pprint(self, object: Author or Publication)->None:
317329 del to_print ['container_type' ]
318330 print (pprint .pformat (to_print ))
319331
332+ def search_org (self , name : str , fromauthor : bool = False ) -> list :
333+ """Search by organization name and return a list of possible disambiguations
334+ :Example::
335+ .. testcode::
336+ search_query = scholarly.search_org('ucla')
337+ print(search_query)
338+ :Output::
339+ .. testoutput::
340+ [{'Organization': 'University of California, Los Angeles',
341+ 'id': '14108176128635076915'},
342+ {'Organization': 'Universidad Centroccidental Lisandro Alvarado',
343+ 'id': '9670678584336165373'}
344+ ]
345+ """
346+
347+ url = _AUTHSEARCH .format (requests .utils .quote (name ))
348+ return self .__nav .search_organization (url , fromauthor )
0 commit comments