Skip to main content

Python Client for Yuleak API.

Project description

Yuleak API

Latest Version on PyPI Documentation Status Licence

The official Python library for the Yuleak API.

Features

  • Convenient methods for making calls to the API.
  • Automatic parsing of API responses into Python objects.

Installation

yuleak-api is available on PYPI

pip install yuleak-api

Documentation

You can use the API with default demo key for development purpose but to use it you'll need to register to Yuleak.

Authentication

from yuleak_api.client import YuleakClient
YuleakClient.set_apikey('my_secret_api_key')

Errors

In case of error, GET methods will return an empty list and POST/DELETE will return False.

The error will be displayed in yuleak-api logger.

Warnings will (such as a deprecated endpoint) will also be displayed in yuleak-api logger.

Pagination

Pagination will be handle by the YuleakClient, you do not have to care about.

Usage

This is not intended to provide complete documentation of the API.

For more details, please refer to the official documentation.

For more information on the included models and abstractions, please read the code.

Credits

Please check your credits amount before making any search or renew action to avoid errors.

print(YuleakClient.credits())

Dashboards

dashboards = YuleakClient.dashboards()
for dashboard in dashboards:
    # Display stats (similar to dashboard view in WebUI)
    print(dashboard.stats())
    # Display map (similar to map widget in WebUI)
    print(dashboard.map())
    # Display graph (similar to graph view in WebUI)
    for node in dashboard.graph():
        if node.type == 'asn':
            print('AS: {0}'.format(node.label))
            for child in node.neighbors:
                if child.type == 'server':
                    print(child)
    # Display timeline (similar to timeline widget in WebUI)
    print(dashboard.timeline())
    # Display details (similar to details view in WebUI)
    for server in dashboard.details():
        print(server.geo.country_name)
    dashboard.delete()

Resources

resources = dashboard.resources()
for resource in resources:
    print('{0} :: {1}'.format(resource.value, resource.status))
    if resource.type == 'server':
        resource.renew()
    else:
        resource.delete()

Bookmarks

server = dashboard.details()[0]
assert not server.bookmark
server.add_bookmark()
assert server.bookmark
server.del_bookmark()
assert not server.bookmark

Filters

dashboard.add_filter('domain', 'all')
for f in dashboard.filters():
    print(f)
    f.delete()

Search

YuleakClient.search('yuleak.com')
dashboard = YuleakClient.dashboards()[-1]
dashboard.search('yuleak.io')
# Mass search
new_servers = dashboard.list_new_servers()
if YuleakClient.credits() >= new_servers > 0:
    dashboard.searchall()

Changelog

v1.2.0

  • GET dashboard/{id}/searchall added
  • POST dashboard/{id}/searchall added

v1.1.0

  • Change to match the Yuleak API path modifications

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for yuleak-api, version 1.2.0
Filename, size File type Python version Upload date Hashes
Filename, size yuleak-api-1.2.0.tar.gz (8.2 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page