Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.

Repository files navigation

JupiterOne Python SDK

Python 3.6Python 3.7

A Python library for the JupiterOne API.

Installation

Requires Python 3.6+

pip install jupiterone

Usage

Create a new client:
fromjupiteroneimportJupiterOneClientj1=JupiterOneClient(
account='<yourAccountId>',
token='<yourApiToken>'
)
Execute a query:
QUERY='FIND Host'query_result=j1.query_v1(QUERY)
# Using LIMIT and SKIP for paginationquery_result=j1.query_v1(QUERY, limit=5, skip=5)
# Including deleted entitiesquery_result=j1.query_v1(QUERY, include_deleted=True)
# Tree queryQUERY='FIND Host RETURN TREE'query_result=j1.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>')

About

A Python client for jupiterone.io

Resources

Contributing

Security policy

Stars

10 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages