@@ -207,17 +207,22 @@ def q2(
207207 hasLibTld = TLD_LIB_PRESENT ,
208208 )
209209
210- wr = WhoisRdap ()
211- dd = wr .do_one_domain (domain )
212- if dd .status :
213- with_rdap_whois = True
214- d : dict [str , Any ] = wr .map_data_to_whoisdomain (dd .data , with_rdap_whois = with_rdap_whois )
215- rr = Domain (pc = pc , dc = dc )
216- rr .from_whodap_dict (d )
217- msg = f"lookup: { domain } using whodap"
218- log .info (msg )
219- return rr # also show the raw data from whodap
220- log .warning (dd ) # no proper answer from rdap try whois
210+ if pc .whoisOnly is False :
211+ wr = WhoisRdap ()
212+ dd = wr .do_one_domain (domain )
213+ if dd .status :
214+ with_rdap_whois = True
215+ d : dict [str , Any ] = wr .map_data_to_whoisdomain (dd .data , with_rdap_whois = with_rdap_whois )
216+
217+ rr = Domain (pc = pc , dc = dc )
218+ rr .from_whodap_dict (d )
219+ msg = f"lookup: { domain } using whodap"
220+ log .info (msg )
221+ return rr # also show the raw data from whodap
222+
223+ log .warning (dd ) # no proper answer from rdap try whois
224+ if pc .rdapOnly is True :
225+ return None
221226
222227 initLastWhois ()
223228
@@ -245,6 +250,7 @@ def q2(
245250 )
246251
247252 result = pwdr .processRequest ()
253+
248254 del pwdr
249255 del dom
250256 del wci
@@ -259,42 +265,20 @@ def q2(
259265 return result
260266
261267
262- # force: bool = False,
263- # cache_file: str | None = None,
264- # cache_age: int = 60 * 60 * 48,
265- # slow_down: int = 0,
266- # ignore_returncode: bool = False,
267- # server: str | None = None,
268- # verbose: bool = False,
269- # with_cleanup_results: bool = False,
270- # internationalized: bool = False,
271- # include_raw_whois_text: bool = False,
272- # return_raw_text_for_unsupported_tld: bool = False,
273- # timeout: float | None = None,
274- # parse_partial_response: bool = False,
275- # cmd: str = "whois",
276- # simplistic: bool = False,
277- # withRedacted: bool = False,
278- # tryInstallMissingWhoisOnWindows: bool = False,
279- # shortResponseLen: int = 5,
280- # withPublicSuffix: bool = False,
281- # extractServers: bool = False,
282- # stripHttpStatus: bool = False,
283- # noIgnoreWww: bool = False,
284-
285-
286268def query (
287269 domain : str ,
288270 * ,
289271 pc : ParameterContext | None = None ,
290272 verbose : bool = False ,
291273 ** kwargs : Any ,
274+ # see documentation about parameters in context/parameterContext.py
292275 # force: bool = False,
293276 # cache_file: str | None = None,
294277 # cache_age: int = 60 * 60 * 48,
295278 # slow_down: int = 0,
296279 # ignore_returncode: bool = False,
297280 # server: str | None = None,
281+ # verbose: bool = False,
298282 # with_cleanup_results: bool = False,
299283 # internationalized: bool = False,
300284 # include_raw_whois_text: bool = False,
@@ -310,39 +294,16 @@ def query(
310294 # extractServers: bool = False,
311295 # stripHttpStatus: bool = False,
312296 # noIgnoreWww: bool = False,
297+ # rdapOnly: bool = false,
298+ # whoisOnly: bool = false,
313299) -> Domain | None :
314- # see documentation about paramaters in parameterContext.py
315-
316300 assert isinstance (domain , str ), Exception ("`domain` - must be <str>" )
317301
318302 if verbose is True :
319303 logging .basicConfig (level = "DEBUG" )
320304
321305 if pc is None :
322306 pc = ParameterContext (** kwargs )
323- # force=force,
324- # cache_file=cache_file,
325- # cache_age=cache_age,
326- # slow_down=slow_down,
327- # ignore_returncode=ignore_returncode,
328- # server=server,
329- # verbose=verbose,
330- # with_cleanup_results=with_cleanup_results,
331- # internationalized=internationalized,
332- # include_raw_whois_text=include_raw_whois_text,
333- # return_raw_text_for_unsupported_tld=return_raw_text_for_unsupported_tld,
334- # timeout=timeout,
335- # parse_partial_response=parse_partial_response,
336- # cmd=cmd,
337- # simplistic=simplistic,
338- # withRedacted=withRedacted,
339- # withPublicSuffix=withPublicSuffix,
340- # shortResponseLen=shortResponseLen,
341- # tryInstallMissingWhoisOnWindows=tryInstallMissingWhoisOnWindows,
342- # extractServers=extractServers,
343- # stripHttpStatus=stripHttpStatus,
344- # noIgnoreWww=noIgnoreWww,
345- # )
346307
347308 msg = f"{ pc } "
348309 log .debug (msg )
0 commit comments