purecloudlabs / threatstack-python-client Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
PyPi hasn't been updated so piup is still pulling down an older version which doesn't have the changes for the new auth.
Im using an unpinned threatstack version, but i tried to rebuild today and saw that user_id
is now required.
I dont see any documentation around anything else thats changed, but :
>>> import os
>>> from threatstack import ThreatStack
>>> threatstack_api_key=os.getenv('api_key')
>>> threatstack_org_id=os.getenv('org_id')
>>> threatstack_user_id=os.getenv('user_id')
>>> threatstack_client = ThreatStack(api_key=threatstack_api_key, org_id=threatstack_org_id, user_id=threatstack_user_id)
>>> threatstack_client.servers.list(non_monitored=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Client' object has no attribute 'servers'
Need to adjust handle_response logic to account for 502 responses. It appears Threat Stack sends back and HTML response for 502s.
Example:
{'_content': b'
I'm using version 1.2.0 of this module:
$ pip freeze | grep threatstack
threatstack==1.2.0
I can run through the steps in the docs trying to get alerts, but I always wind up with an empty list. Something's wrong with the generator.
from datetime import datetime, timedelta
from threatstack import ThreatStack
api_key = 'my_api_key'
org_id = 'my_org_id'
user_id = 'my_user_id'
client = ThreatStack(api_key=api_key, org_id=org_id, user_id=user_id)
now = datetime.now()
yesterday = now - timedelta(days=1)
alerts = client.alerts.list(start=yesterday, end=now)
print([ alert for alert in alerts ])
The output:
[]
If I look in the web UI, I can see several alerts occurring in the past day. I should get more than an empty list here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.