GithubHelp home page GithubHelp logo

threatstack-python-client's People

Contributors

dannyrappleyea avatar gvauter avatar inindevevangelists avatar rappleyea-genesys avatar rpless avatar tmclaugh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

threatstack-python-client's Issues

Publish 1.1.2 to PyPi

PyPi hasn't been updated so piup is still pulling down an older version which doesn't have the changes for the new auth.

1.2.0 docs

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'

client.py does not properly handle 502 response

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'

502 Bad Gateway

\nThe server returned an invalid or incomplete response.\n\n', '_content_consumed': True, '_next': None, 'status_code': 502, 'headers': {'Cache-Control': 'no-cache', 'Connection': 'close', 'Content-Type': 'text/html'}, 'raw': <urllib3.response.HTTPResponse object at 0x10e3c52e8>, 'url': 'https://app.threatstack.com/api/v1/alerts?count=100&page=3', 'encoding': 'ISO-8859-1', 'history': [], 'reason': 'Bad Gateway', 'cookies': <RequestsCookieJar[]>, 'elapsed': datetime.timedelta(0, 120, 144756), 'request': <PreparedRequest [GET]>, 'connection': <requests.adapters.HTTPAdapter object at 0x10e3c5c50>}

Cannot retrieve alerts

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.