catpy.applications.base module¶
-
class
catpy.applications.base.
CatmaidClientApplication
(catmaid_client)[source]¶ Bases:
catpy.client.AbstractCatmaidClient
An application which uses the CATMAID interface. Users should subclass this when creating their own applications.
Attributes: - base_url
- project_id
Methods
fetch
(*args, **kwargs)Interact with the CATMAID server in a manner very similar to the javascript CATMAID.fetch API. from_json
(credentials, *args, **kwargs)Return a CatmaidClientApplication instance whose underlying CatmaidClient object is instantiated from the JSON file as per its own from_json method. get
(relative_url[, params, raw])Get data from a running instance of CATMAID. post
(relative_url[, data, raw])Post data to a running instance of CATMAID. -
base_url
¶
-
fetch
(*args, **kwargs)¶ Interact with the CATMAID server in a manner very similar to the javascript CATMAID.fetch API.
Parameters: - relative_url : str or tuple of str
URL to send the request to, relative to the base_url. If a tuple is passed, its elements will be joined with ‘/’.
- method: {‘GET’, ‘POST’}, optional
HTTP method to use (the default is ‘GET’)
- data: dict or str, optional
JSON-like key/value data to be included in the request as a payload (defaults to empty)
- raw: bool, optional
Whether to return the response as a string regardless of its content-type (by default, JSON responses will be parsed)
- kwargs
Extra keyword arguments to pass to requests.Session.get/post(), depending on method
Returns: - dict or list or str
Data returned from CATMAID. JSON responses will be parsed unless raw is True; all other responses will be returned as strings.
-
classmethod
from_json
(credentials, *args, **kwargs)[source]¶ Return a CatmaidClientApplication instance whose underlying CatmaidClient object is instantiated from the JSON file as per its own from_json method.
Parameters: - path : str
Path to the JSON credentials file
- args, kwargs
Arguments passed to constructor of concrete subclass
Returns: - CatmaidClient
Instance of the API, authenticated with
-
project_id
¶