goat.authorities package¶
Submodules¶
goat.authorities.util module¶
Helper functions for parsing authority descriptions.
Bases:
list
Adds
get
support to a list.Return the value of
key
in the first object in list.
Return the value of
key
in each object in list.
Bases:
dict
Generates a function that retrives the CDATA content or attribute value of an element.
env : dict
function
Split a path string into its constituent parts.
path_string : str
path : list attribute : str or None
Generate a function that performs an HTTP request based on the configuration in
config
.config : dict glob : dict
- function
- Expects keyword arguments defined in the configuration. If provided,
headers
will be pulled out and passed as headers in the request.
Generate a recursive function that follows the path in
tags
, starting atelem
.
Detect the multi-value flag (
*
) in a path part (tag
).tag : str
- tuple
- tag name (str), multiple (bool)
Generate a function that will retrieve data of interest from a
JSONData
object.- path_string : str
- See docs for how this should be written. TODO: write the docs.
- nsmap: dict
- Not used.
picker_factory : function
function
Parse raw JSON response content.
raw : unicode
lxml.etree.Element
Parse raw XML response content.
raw : unicode
lxml.etree.Element
Extract data from an
lxml.etree.Element
using a configuration schema.config : dict data :
lxml.etree.Element
path_parser : function glob : dict nsmap : dictlist
Generate a function that will retrieve data of interest from an
lxml.etree.Element
.- path_string : str
- See docs for how this should be written. TODO: write the docs.
- nsmap: dict
- See the
lxml.etree
docs.
picker_factory : function
function
Generates a function that simply returns a passed
lxml.etree.Element
.env : dict
function
Module contents¶
Bases:
object
Configuration-driven manager for authority services.
- config : str
- Name of an authority configuration in
authorities
. Will look for{path}/{config}.json
. - path : str
- Location of configurations.
Get a concept record from the configured authority.
Although both
identifier
andlocal_identifier
are declared as optional, it is a good idea to pass them both and let the configuration sort things out.- identifier : str
- Used to populate the
id
parameter in the request. - local_identifier : str
- Used to populate the
local_id
parameter in the request.
dict
Search for concept records in the configured authority.
- params : kwargs
- Query parameters used to populate the search request.
list
Bases:
object