fdi.pns package

Submodules

fdi.pns.config module

fdi.pns.fdi_requests module

fdi.pns.jsonio module

fdi.pns.jsonio.auth_headers(username=None, password=None, headers=None)[source]

Generate HTTP header with auth.

Parameters:
  • username (str) – user name. Default is None.

  • password (str) – Password. Set both username and password to None to use the values in pnconfig[“node”].

  • headers (dict) – key-values of HTTP headers, Default is None for using jsonio.commonheaders.

Examples

FIXME: Add docs.

fdi.pns.jsonio.deleteJsonObj(url, obj, headers)[source]

deletes object from url. Returns None if fails.

fdi.pns.jsonio.getJsonObj(url, headers=None, usedict=True, int_key=False, **kwds)[source]

return object from url. url can be http or file.

Int_key:

translate keys from string to int if True Raise exception if fails.

Not using requests.get() as it cannot open file:/// w/o installing https://pypi.python.org/pypi/requests-file

fdi.pns.jsonio.postJsonObj(url, obj, headers)[source]

posts object to url. Returns None if fails.

fdi.pns.jsonio.putJsonObj(url, obj, headers)[source]

puts object to url. Returns None if fails.

fdi.pns.jsonio.writeJsonObj(o, fn)[source]

Write an object to file fn in json safely Return True if successful else False

fdi.pns.logdict module

fdi.pns.pns_server module

fdi.pns.public_fdi_requests module

fdi.pns.runflaskserver module

fdi.pns.runflaskserver.setuplogging(level=30)[source]

fdi.pns.server_skeleton module

fdi.pns.urlconf module

fdi.pns.urlconf.urn2url(urn, contents='product')[source]

Returns URL for accessing pools with a URN.

contents: ‘product’ for returning a product from the pool. ‘hk’ for returning the housekeeping data of the pool. ‘classes’ for returning the class housekeeping data of the pool. ‘urns’ for returning the URN housekeeping data of the pool. ‘tags’ for returning the tag housekeeping data of the pool.

Example: IP=ip dir=/a/b/c files=/a/b//c/classes.jsn | urns.jsn | t.. | urn…

with python: m.refs[‘myinput’] = special_ref ref=pstore.save(m) assert ref.urn == ‘urn:http://ip:port/a/b/c/fdi.dataset.MapContext:203’ p=ref.product myref=p.refs[‘myinput’]

with a pool: myref=pool.load(’http://ip:port/v0.6/a/b/c/fdi.dataset.MapContext/203/refs/myinput’)

urn:http://ip:port/a/b/c/fdi.dataset.Product:203 ==> http://ip:port/v0.6/a/b/c/fdi.dataset.Product/203/meta/OBSID

At the same time this is not allowed due to overlapping after ‘c’

urn:http://ip:port/a/b/d/fdi.dataset.Product:203 ==> http://ip:port/v0.6/a/b/c/d/

This is also overlapping starting from ‘/’

urn:http://ip:port/fdi.dataset.Product:203 ==> http://ip:port/v0.6/

but for example this is allowed:

urn:http://ip:port/a/k/fdi.dataset.Product:203 ==> http://ip:port/v0.6/a/k/