forked from auth0/jupiterone-python-sdk
-
Couldn't load subscription status.
- Fork 5
Resolve conflicts migrate repo #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
7f656cc
calling the J1 sync results API
tywalch af23ad9
benchmarked to be faster:
tywalch b5e715e
Fixing tests
tywalch f2e1dce
Clean up
tywalch b2b178f
Bumping version
tywalch 7000588
Merge pull request #11 from JupiterOne/sync-calls-with-cursor
gvauter b516596
Added handling of 401 and other responses that aren't JSON.
lmarkscp 0d3a5ae
Cleaned up handling of error(s) in json
lmarkscp f6a9d56
Upload OpsLevel YAML
sre-57-opslevel[bot] 1c63eaf
Merge pull request #14 from auth0/SRE-57-Upload-opslevel-yaml
gvauter 49537d1
Merge pull request #13 from lmarkscp/improve-response-error-handling
gvauter 7b76a46
bumping version
cleorun 95b2f74
Merge pull request #16 from auth0/0.2.1
cleorun 79a1d9a
Update setup.py
SeaBlooms 4f85ce6
Create examples.py
SeaBlooms d3a0e55
Delete opslevel.yml
SeaBlooms fa8ae1a
Update client.py
SeaBlooms 485480c
Update examples.py
SeaBlooms 0dc3965
fix PEP8 checks
SeaBlooms 5636501
more PEP8 fixes, updated README, bump to v1.0.0
SeaBlooms 8e2b923
handle 500 response
SeaBlooms 339daae
Update client.py
SeaBlooms f3953b1
updated cursor docs link
SeaBlooms c05addd
Update LICENSE
SeaBlooms 9179812
Delete .travis.yml
SeaBlooms c4a35d1
Merge branch 'main' into resolveConflictsMigrateRepo
SeaBlooms a5866dc
Update client.py
SeaBlooms File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| from jupiterone.client import JupiterOneClient | ||
| import random | ||
| import time | ||
| import os | ||
|
|
||
| account = os.environ.get("JUPITERONE_ACCOUNT") | ||
| token = os.environ.get("JUPITERONE_TOKEN") | ||
|
|
||
| j1 = JupiterOneClient(account=account, token=token) | ||
|
|
||
| # query_v1 | ||
| q = "FIND jupiterone_user" | ||
| query_r = j1.query_v1(q) | ||
| print(query_r) | ||
|
|
||
| # create_entity | ||
| num1 = random.randrange(1, 999, 1) | ||
|
|
||
| # create_entity | ||
| properties = { | ||
| 'displayName': 'test{}'.format(num1), | ||
| 'customProperty': 'customVal', | ||
| 'tag.Production': 'false', | ||
| 'owner': 'user.name@jupiterone.com' | ||
| } | ||
|
|
||
| create_r = j1.create_entity( | ||
| entity_key='jupiterone-api-client-python:{}'.format(num1), | ||
| entity_type='python_client_create_entity', | ||
| entity_class='Record', | ||
| properties=properties, | ||
| timestamp=int(time.time()) * 1000 # Optional, defaults to current datetime | ||
| ) | ||
| print(create_r) | ||
|
|
||
| properties = { | ||
| 'customProperty': 'customValUpdated' | ||
| } | ||
|
|
||
| # update_entity | ||
| update_r = j1.update_entity( | ||
| entity_id='{}'.format(create_r['entity']['_id']), | ||
| properties=properties | ||
| ) | ||
| print(update_r) | ||
|
|
||
| # create_entity_2 | ||
| num2 = random.randrange(1, 999, 1) | ||
|
|
||
| properties = { | ||
| 'displayName': 'test{}'.format(num2), | ||
| 'customProperty': 'customVal', | ||
| 'tag.Production': 'false', | ||
| 'owner': 'user.name@jupiterone.com' | ||
| } | ||
|
|
||
| create_r_2 = j1.create_entity( | ||
| entity_key='jupiterone-api-client-python:{}'.format(num2), | ||
| entity_type='python_client_create_entity', | ||
| entity_class='Record', | ||
| properties=properties, | ||
| timestamp=int(time.time()) * 1000 # Optional, defaults to current datetime | ||
| ) | ||
| print(create_r_2) | ||
|
|
||
| # create_relationship | ||
| create_relationship_r = j1.create_relationship( | ||
| relationship_key='{}:{}'.format(create_r['entity']['_id'], create_r_2['entity']['_id']), | ||
| relationship_type='jupiterone-api-client-python:create_relationship', | ||
| relationship_class='HAS', | ||
| from_entity_id=create_r['entity']['_id'], | ||
| to_entity_id=create_r_2['entity']['_id'] | ||
| ) | ||
| print(create_relationship_r) | ||
|
|
||
| # delete_relationship | ||
| delete_relationship_r = j1.delete_relationship(relationship_id=create_relationship_r['relationship']['_id']) | ||
| print(delete_relationship_r) | ||
|
|
||
| # delete_entity | ||
| delete_entity_r1 = j1.delete_entity(entity_id=create_r['entity']['_id']) | ||
| print(delete_entity_r1) | ||
|
|
||
| delete_entity_r2 = j1.delete_entity(entity_id=create_r_2['entity']['_id']) | ||
| print(delete_entity_r2) | ||
|
|
||
|
|
||
| q = "FIND (Device | Person)" | ||
| cursor_query_r = j1._cursor_query(q) | ||
| print(cursor_query_r) | ||
| print(len(cursor_query_r['data'])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ | |
| from .errors import ( | ||
| JupiterOneClientError, | ||
| JupiterOneApiError | ||
| ) | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| retrying | ||
| requests | ||
| warnings |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.