jupiterone

A Python client for the JupiterOne API


License
MIT
Install
pip install jupiterone==0.1.0

Documentation

JupiterOne Python SDK

Python 3.6 Python 3.7

A Python library for the JupiterOne API.

Installation

Requires Python 3.6+

pip install jupiteorne

Usage

Create a new client:
from jupiterone import JupiterOneClient

j1 = JupiterOneClient(
    account='<yourAccountId>',
    token='<yourApiToken>'
)
Execute a query:
QUERY = 'FIND Host'
query_result = j1.query_v1(QUERY)

# Using LIMIT and SKIP for pagination
query_result = j1.query_v1(QUERY, limit=5, skip=5)

# Including deleted entities
query_result = j1.query_v1(QUERY, include_deleted=True)

# Tree query
QUERY = 'FIND Host RETURN TREE'
query_result = jq.query_v1(QUERY)


Create an entity:

Note that the CreateEntity mutation behaves like an upsert, so an non-existant entity will be created or an existing entity will be updated.

properties = {
    'myProperty': 'myValue',
    'tag.myTagProperty': 'value_will_be_a_tag'
}

entity = j1.create_entity(
   entity_key='my-unique-key',
   entity_type='my_type',
   entity_class='MyClass',
   properties=properties,
   timestamp=int(time.time()) * 1000 # Optional, defaults to current datetime
)
print(entity['entity'])

Update an existing entity:

Only send in properties you want to add or update, other existing properties will not be modified.

properties = {
    'newProperty': 'newPropertyValue'
}

j1.update_entity(
    entity_id='<id-of-entity-to-update>',
    properties=properties
)

Delete an entity:

j1.delete_entity(entit_id='<id-of-entity-to-delete>')
Create a relationship
j1.create_relationship(
    relationship_key='this_entity_relates_to_that_entity',
    relationship_type='my_relationship_type',
    relationship_class='MYRELATIONSHIP',
    from_entity_id='<id-of-source-entity>',
    to_entity_id='<id-of-destination-entity>'
)
Delete a relationship
j1.delete_relationship(relationship_id='<id-of-relationship-to-delete>')