Skip to main content

Client API for using the Boa infrastructure

Project description

About Boa Python Client API

The Boa Python Client API provides programmatic access to the Boa language and infrastructure from Python.

About Boa

For more information about Boa, please see the main website:

Creating a client

The main entry point for the API is a BoaClient object. You use this to log in, submit queries, find datasets, log out, etc. To instantiate this object, you must provide the API endpoint's URL. The API has several constants for common endpoints:

BOA_API_ENDPOINT - for the Boa MSR endpoint BOAC_API_ENDPOINT - for the Boa CORD-19 endpoint

For example if you want a client for the CORD-19 endpoint, you do the following:

client = BoaClient(endpoint=BOAC_API_ENDPOINT)

If you don't specify an endpoint, it will default to the MSR endpoint.

Example Use (using MSR endpoint)

import time

from boaapi.boa_client import BoaClient, BOA_API_ENDPOINT

client = BoaClient(endpoint=BOA_API_ENDPOINT)
client.login("boa username", "boa password")
print('successfully logged in to Boa API')

query = """# Counting the 10 most used programming languages
p: Project = input;
counts: output top(10) of string weight int;

foreach (i: int; def(p.programming_languages[i]))
    counts << p.programming_languages[i] weight 1;"""

# query using a specific dataset
job = client.query(query, client.get_dataset('2019 October/GitHub'))
print('query submitted')

while job.is_running():
    print('job ' + str( + ' still running, waiting 10s...')

if job.compiler_status == 'Error':
    print('job ' + str( + ' had compile error')
elif job.exec_status == 'Error':
    print('job ' + str( + ' had exec error')
        output = job.output().decode('utf-8')

print('client closed')

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 boa-api, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size boa_api-0.1.4-py3-none-any.whl (11.7 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size boa-api-0.1.4.tar.gz (5.7 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page