Previous topic

Bulbs API

Next topic

Element

Donate Bitcoins

Config

Configuration options for Bulbs.

You can create a custom Config object and pass it as a param to Graph, but this is not required.

Graph will use the default Config object and the default root URI for the server if you don’t pass one in.

class bulbs.config.Config(root_uri, username=None, password=None)[source]

Configuration options for Bulbs.

Parameters:
  • root_uri (str) – Root URI of the database.
  • username (str) – Optional username. Defaults to None.
  • password (str) – Optional password. Defaults to None.
Variables:
  • root_uri – Root URI of the server.
  • username – Optional username. Defaults to None.
  • password – Optional password. Defaults to None.
  • log_level – Python log level. Defaults to ERROR.
  • log_handler – Python log handler. Defaults to StreamHandler.
  • id_var – Name of the element ID variable. Defaults to “eid”.
  • type_var – Name of the type variable. Defaults to “element_type”.
  • label_var – Name of the label variable. Defaults to “label”.
  • type_system – Name of the type system. Defaults to “json”.
  • vertex_index – Name of the vertex index. Defaults to “vertex”.
  • edge_index – Name of the edge index. Defaults to “edge”.
  • autoindex – Enable auto indexing. Defaults to True.
  • server_scripts – Scripts are defined server side. Defaults to False.

Example:

>>> from bulbs.config import Config, DEBUG
>>> from bulbs.neo4jserver import Graph, NEO4J_URI
>>> config = Config(NEO4J_URI, username="james", password="secret")
>>> config.set_logger(DEBUG)
>>> g = Graph(config)
set_logger(log_level, log_handler=None)[source]

Sets or updates the log level and log handler.

Parameters:
  • log_level (int) – Python log level.
  • log_handler (logging.Handler) – Python log handler. Defaults to log_handler.
Return type:

None

set_neo4j_heroku(log_level=40, log_handler=None)[source]

Sets credentials if using the Neo4j Heroku Add On.

Parameters:
  • log_level (int) – Python log level. Defaults to ERROR.
  • log_handler (logging.Handler) – Python log handler. Defaults to log_handler.
Return type:

None