BaseClient

class sunpy.net.base_client.BaseClient[source]

Bases: abc.ABC

This defines the Abstract Base Class for each download client.

The BaseClient has several abstract methods that ensure that any subclass enforces the bare minimum API. These are search, fetch and _can_handle_query. The last one ensures that each download client can be registered with Fido.

Most download clients should subclass GenericClient. If the structure of GenericClient is not useful you should use BaseClient. VSOClient and JSOCClient are examples of download clients that subclass BaseClient.

Methods Summary

check_attr_types_in_query(query[, …])

Check a query againsted required and optional attributes.

fetch(*query_results[, path, overwrite, …])

This enables the user to fetch the data using the client, after a search.

register_values(*query)

This enables the client to register what kind of Attrs it can use directly.

search(*args, **kwargs)

This enables the user to search for data using the client.

Methods Documentation

static check_attr_types_in_query(query, required_attrs={}, optional_attrs={})[source]

Check a query againsted required and optional attributes.

Returns True if query contains all the attrs in required_attrs, and if query contains only attrs in both required_attrs and optional_attrs.

abstract fetch(*query_results, path=None, overwrite=False, progress=True, max_conn=5, downloader=None, wait=True, **kwargs)[source]

This enables the user to fetch the data using the client, after a search.

Parameters
  • query_results – Results to download.

  • path (str or pathlib.Path, optional) – Path to the download directory

  • overwrite (bool, optional) – Replace files with the same name if True.

  • progress (bool, optional) – Print progress info to terminal.

  • max_conns (int, optional) – Maximum number of download connections.

  • downloader (parfive.Downloader, optional) – The download manager to use.

  • wait (bool, optional) – If False downloader.download() will not be called. Only has any effect if downloader is not None.

Returns

parfive.Results – The results object, can be None if wait is False.

classmethod register_values(*query)[source]

This enables the client to register what kind of Attrs it can use directly.

Returns

dict – A dictionary with key values of Attrs and the values are a tuple of (“Attr Type”, “Name”, “Description”).

abstract search(*args, **kwargs)[source]

This enables the user to search for data using the client.

Must return a subclass of BaseQueryResponse.