Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bvapi
tests
.gitignore
.venv
LICENSE
README.md
TODO
setup.cfg
setup.py

README.md

BroadView API Client

A basic library to interface with SensePost BroadView Servers.

Basic Usage

>>> import bvapi
>>> client = bvapi.Client(url="https://yourbroadviewserver/api/v1", user="yourusername", password="yourpassword")
>>> client.status()
{u'status': u'success', u'current_time': u'2013-03-27T09:01:52.842965+02:00', u'instance_url': u'unconfigured', u'version': u'v1', u'user': u'admin'}

API Details

Each API call returns a dictionary, unless an error occrus in which case an exception is raised. This dictionary will contain the data requested and possible additionaly information, see the API methods for which keys will be populated with the requested data. Since this library interfaces with a JSON API it will return only basic types(lists, dicts, strings, integers etc). All dates and times will be in ISO 8601 Format with a timezone.

API Methods

status()

Used to determine if server is currently serving requests and if authentication succeeds. It also returns the following info:

  • current_time The server's current time in ISO 8601 format including timezone.
  • instance_url The URL for the servers web interface if configured.
  • version The version of the API at the queried location.
  • user The name of the user used in the request.

accounts()

Returns all the accounts the user can access in the 'accounts' key.

jobs(account_id)

Return all the jobs for the specified account_id in the 'jobs' key. Order is descending.

scans(job_id, [count])

Returns the last scans for the specified job_id in the 'scans' key. Order is descending. An optional count parameter may be given to control the amount of scans returned. The server will impose a maximum count.

scan_data(scan_id)

Return the scan requested with its issues. The scan will be a dictionary under the 'scan' key, it will contain a key named 'issues' with the scans issues.

Exceptions

Any error will generate an exception derived from bvapi.exceptions.ApiException or it will be an exception generated by a dependency such as requests(If the connections fails etc). The following exceptions are defined:

NotAuthorisedError

User was not authorized to perform the API call or access the specified resource.

NotFoundError

The specified resource was not found.

License

See the file LICENSE for full license text.

Copyright SensePost Pty Ltd 2013