GenericClient#
- class sunpy.net.dataretriever.client.GenericClient[source]#
Bases:
BaseClientBase class for simple web clients for the data retriever module. This class is mainly designed for downloading data from FTP and HTTP type data sources, although should in theory be general enough to get data from any web service.
This class has two user facing methods
searchandfetchthe former generates a set of results for files available through the service the client is querying and the latter downloads that data.Search uses two hooks as helper functions; these are
pre_search_hook()andpost_search_hook(). They help to translate the attrs for scraper before and after the search respectively.Attributes Summary
Methods Summary
fetch(qres[, path, overwrite, progress, ...])Download a set of results.
post_search_hook(exdict, matchdict)Helper function used after
search()which makes the extracted metadata representable in a query response table.pre_search_hook(*args, **kwargs)Helper function to return the pattern and matchdict for the client required by
search()before using the scraper.search(*args, **kwargs)Query this client for a list of results.
Attributes Documentation
- baseurl = None#
- enqueue_file_kwargs = {}#
- pattern = None#
- required = {<class 'sunpy.net.attrs.Instrument'> sunpy.net.attrs.Instrument Specifies the Instrument name for the search. Attribute Name ... --------------------------- ... adapt ... aia ... aia ... bcs ... be_continuum ... be_halpha ... bigbear ... c1 ... c2 ... caii ... cds ... celias ... cerrotololo ... chp ... cook ... costep ... cp ... dpm ... eis ... eit ... elteide ... erne ... eui ... eve ... eve ... film ... five_12_channelmagnetograph ... foxsi ... gbm ... goes ... golf ... gong ... ha2 ... hi_c ... hi_c21 ... hmi ... hxeclipse ... hxt ... imax ... impact ... iris ... isoon ... iss ... ivm ... k_cor ... kpdc ... l1 ... l2 ... lasco ... learmonth ... longwave_lobe_06 ... longwave_lobe_07 ... longwave_slit_06 ... longwave_slit_07 ... lyra ... lyra ... maunaloa ... mdi ... mees ... mergedgong ... metis ... meudonspectroheliograph ... mk4 ... nfi_0 ... noaa_indices ... noaa_predict ... norh ... phi ... phoenix ... phoka ... plastic ... polar ... ptmc ... rhessi ... rhessi ... secchi ... shortwave_lobe_06 ... shortwave_lobe_07 ... shortwave_slit_06 ... shortwave_slit_07 ... six_0_ftshg ... sj ... solarftsspectrometer ... solohi ... soon ... sot ... sp1 ... sp2 ... spectroheliograph ... spectromagnetograph ... spice ... srs_table ... stix ... sufi ... sumer ... sutri ... suvi ... suvi ... swan ... swap ... swaves ... sxt ... t1_halpha ... t4_cak ... t4_continuum ... t4_gband ... tm_1001 ... tm_1010 ... trace ... udaipur ... unpolarized ... uvcs ... vault_1999 ... vault_2002 ... vault_2014 ... virgo ... vsm ... wbs ... wfi_1 ... wfi_2 ... wfi_3 ... wispr ... x123 ... xrs ... xrt ..., <class 'sunpy.net.attrs.Time'> sunpy.net.attrs.Time Specify the time range of the query. Attribute Name Client Full Name Description -------------- ----------- --------- -------------------------------------- all NOAAIndices all All values of this type are supported. all NOAAPredict all All values of this type are supported.}#
Methods Documentation
- fetch(
- qres,
- path=None,
- overwrite=False,
- progress=True,
- downloader=None,
- wait=True,
- **kwargs,
Download a set of results.
- Parameters:
qres (
QueryResponse) – Results to download.path (
strorpathlib.Path, optional) – Path to the download directory, or file template including the{file}string which will be replaced with the filename.overwrite (
boolorstr, optional) – Determine how to handle downloading if a file already exists with the same name. IfFalsethe file download will be skipped and the path returned to the existing file, ifTruethe file will be downloaded and the existing file will be overwritten, if'unique'the filename will be modified to be unique.progress (
bool, optional) – IfTrueshow a progress bar showing how many of the total files have been downloaded. IfFalse, no progress bar will be shown.downloader (
parfive.Downloader, optional) – The download manager to use.wait (
bool, optional) – IfFalsedownloader.download()will not be called. Only has any effect ifdownloaderis notNone.
- Returns:
- post_search_hook(exdict, matchdict)[source]#
Helper function used after
search()which makes the extracted metadata representable in a query response table.- Parameters:
- Returns:
rowdict (
OrderedDict) – An Ordered Dictionary which is used byQueryResponseto show results.
- classmethod pre_search_hook(*args, **kwargs)[source]#
Helper function to return the pattern and matchdict for the client required by
search()before using the scraper.
- search(*args, **kwargs)[source]#
Query this client for a list of results.
- Parameters:
*args (
tuple) –sunpy.net.attrsobjects representing the query.**kwargs (
dict) – Any extra keywords to refine the search.
- Returns:
A
QueryResponseinstance containing the query result.