@@ -123,7 +123,8 @@ def keywords(self, value):
123123 def keywords (self ):
124124 self ._keywords = None
125125
126- def find_catalogs (self , keywords , include_obsolete = False , verbose = False ):
126+ def find_catalogs (self , keywords , include_obsolete = False , verbose = False ,
127+ max_catalogs = None ):
127128 """
128129 Search Vizier for catalogs based on a set of keywords, e.g. author name
129130
@@ -136,6 +137,9 @@ def find_catalogs(self, keywords, include_obsolete=False, verbose=False):
136137 only the catalogues characterized by all the words are selected."
137138 include_obsolete : bool, optional
138139 If set to True, catalogs marked obsolete will also be returned.
140+ max_catalogs : int or None
141+ The maximum number of catalogs to return. If ``None``, all
142+ catalogs will be returned.
139143
140144 Returns
141145 -------
@@ -159,10 +163,15 @@ def find_catalogs(self, keywords, include_obsolete=False, verbose=False):
159163 keywords = " " .join (keywords )
160164
161165 data_payload = {'-words' : keywords , '-meta.all' : 1 }
166+ if max_catalogs is not None :
167+ data_payload ['-meta.max' ] = max_catalogs
162168 response = self ._request (method = 'POST' ,
163169 url = self ._server_to_url (),
164170 data = data_payload ,
165171 timeout = self .TIMEOUT )
172+ if 'STOP, Max. number of RESOURCE reached' in response .content :
173+ raise ValueError ("Maximum number of catalogs exceeded. Try setting max_catalogs "
174+ "to a large number and try again" )
166175 result = self ._parse_result (response , verbose = verbose , get_catalog_names = True )
167176
168177 # Filter out the obsolete catalogs, unless requested
0 commit comments