himbeerecouch.database

Exceptions

himbeerecouch.database.get_acct()[source]

get the account object

Return type:cloudant.Account
himbeerecouch.database.get_database()[source]

get the database object

Return type:cloudant.Database
himbeerecouch.database.get_processes_code()[source]

get the process code from the database (returned by get_database()) This expects documents in the database that look like:

{
  "type" : "macid_of_rasperry<int>", # i.e. value returned by :func:`himbeere.util.getmacid`
  "name" : "name of the code",
  "modules" : { # these are modules used by this local code
    "name_of_module1" : "<python code>",
    "name_of_module2" : "<python code>",
    ...
  },
  "global_modules" : { # these modules will be exported to *all*
                       # code in this database
    "name_of_global1" : "<python code>",
    "name_of_global2" : "<python code>"
  },
  "code" : "<python code>" # This is the main module, it *must* include a
                           # `main` function
}

Note, all of these are optional. If e.g. "code" is omitted, then only "global_modules" will essentially have any effect as they will be exported to other code in the database.

Returns:dict - dictionary of code available in the database
himbeerecouch.database.send_heartbeat(db=None, **kwargs)[source]
Update the heartbeat document. kwargs are passed into the document and must be json serializable
Parameters:
  • db (str) – database
  • kwargs – keywords (must be JSON-serializable) passed in to heartbeat document
himbeerecouch.database.set_server(srvr)[source]

Set the current server that should be used

Parameters:srvr (str) – server name