For full reference documentation of the socialcontex.ai API, see the API docs
- Installation
- Using the client library
- Using the CLI
Client library for the socialcontext.ai web API
$ pip install git+https://github.com/socialcontext-ai/socialcontext.git
from socialcontext.api import SocialcontextClient
client = SocialcontextClient(APPLICATION_ID, APPLICATION_SECRET)
job_list = client.jobs().json()['jobs']
job = client.create_job(
input_file='s3://socialcontext-batches/AcmeInc/Job01/urls.txt.gz',
output_path='s3://socialcontext-batches/AcmeInc/Job01/',
models=['antivax', 'provax']
)
client.update_job(job['job_id'], action='schedule')
Get current info about the job, including:
- status
- locations of output files written
- count of URLs processed
- count of batches written
info = client.jobs(job['job_id']).json()
client.update_job(job['job_id'], action='cancel')
client.delete_job(job['job_id'])
Client library for the socialcontext.ai web API.
The CLI will read credentials from the environment. Be sure to set these environment variables:
SOCIALCONTEXT_APP_ID
SOCIALCONTEXT_APP_SECRET
In general, see the command line help and subcommand-specific help for details not covered here.
$ socialcontext --help
$ socialcontext jobs --help
$ socialcontext models
$ socialcontext jobs list
E.g., a classification job for antivax and provax:
$ socialcontext jobs create s3://socialcontext-batches/AcmeInc/Job01/urls.txt.gz --output-path s3://socialcontext-batches/AcmeInc/Job01/ antivax provax
$ socialcontext jobs run $JOB_ID
$ socialcontext jobs info $JOB_ID
$ socialcontext jobs cancel $JOB_ID
$ socialcontext jobs delete $JOB_ID