client¶
-
class
csirtgsdk.client.
Client
(remote='https://csirtg.io/api', token=None, proxy=None, timeout=300, verify_ssl=True)¶ Bases:
object
-
get
(uri, params={})¶ HTTP GET function
Parameters: - uri – REST endpoint
- params – optional HTTP params to pass to the endpoint
Returns: list of results (usually a list of dicts)
- Example:
- ret = cli.get(‘/search’, params={ ‘q’: ‘example.org’ })
-
post
(uri, data)¶ HTTP POST function
Parameters: - uri – REST endpoint to POST to
- data – list of dicts to be passed to the endpoint
Returns: list of dicts, usually will be a list of objects or id’s
- Example:
- ret = cli.post(‘/indicators’, { ‘indicator’: ‘example.com’ })
-
submit_bulk
(indicators, user, feed)¶ Submit action against the IndicatorBulk endpoint
Parameters: - indicators – list of Indicator Objects
- user – feed username
- feed – feed name
Returns: list of Indicator Objects submitted
from csirtgsdk.client import Client from csirtgsdk.indicator import Indicator
remote = ‘https://csirtg.io/api‘ token = ‘’ verify_ssl = True
- i = {
- ‘indicator’: ‘example.com’, ‘feed’: ‘test’, ‘user’: ‘admin’, ‘comment’: ‘this is a test’,
}
data = []
cli = Client(remote=remote, token=token, verify_ssl=verify_ssl)
- for x in range(0, 5):
- data.append(
- Indicator(cli, i)
)
ret = cli.submit_bulk(data, ‘csirtgadgets’, ‘test-feed’)
-