GenericClient#
- class sunpy.net.dataretriever.GenericClient[source]#
Bases:
BaseClient
Base 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
search
andfetch
the 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 baseurl, 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 ... bcs ... be_continuum ... be_halpha ... bigbear ... 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 ... lasco ... learmonth ... longwave_lobe_06 ... longwave_lobe_07 ... longwave_slit_06 ... longwave_slit_07 ... lyra ... lyra ... maunaloa ... mdi ... mees ... mergedgong ... meudonspectroheliograph ... mk4 ... noaa_indices ... noaa_predict ... norh ... phoenix ... phoka ... plastic ... 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 ... sufi ... sumer ... sutri ... suvi ... suvi ... swan ... swap ... swaves ... sxt ... t1_halpha ... tm_1001 ... tm_1010 ... trace ... udaipur ... uvcs ... vault_1999 ... vault_2002 ... vault_2014 ... virgo ... vsm ... wbs ... 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)[source]#
Download a set of results.
- Parameters:
qres (
QueryResponse
) – Results to download.path (
str
orpathlib.Path
, optional) – Path to the download directory, or file template including the{file}
string which will be replaced with the filename.overwrite (
bool
orstr
, optional) – Determine how to handle downloading if a file already exists with the same name. IfFalse
the file download will be skipped and the path returned to the existing file, ifTrue
the file will be downloaded and the existing file will be overwritten, if'unique'
the filename will be modified to be unique.progress (
bool
, optional) – IfTrue
show 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) – IfFalse
downloader.download()
will not be called. Only has any effect ifdownloader
is 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 byQueryResponse
to show results.
- classmethod pre_search_hook(*args, **kwargs)[source]#
Helper function to return the baseurl, 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.attrs
objects representing the query.**kwargs (
dict
) – Any extra keywords to refine the search.
- Returns:
A
QueryResponse
instance containing the query result.