Clients

movesClient

Import:

labpack.activity.moves.movesClient

Description:

a class of methods for retrieving user data from moves api

__init__

Signature:
__init__(self, access_token, service_scope, usage_client=None, requests_handler=None)

Description:
initialization method for moves client class

Argument Type Required Default Description
self object Yes None
access_token str Yes "" string with access token for user provided by moves oauth
service_scope dict Yes None dictionary with service type permissions
usage_client function None callable that records usage data
requests_handlerfunction None callable that handles requests errors

list_activities

Signature:
list_activities(self)

Description:
a method to retrieve the details for all activities currently supported

get_profile

Signature:
get_profile(self)

Description:
a method to retrieve profile details of user

get_summary

Signature:
get_summary(self, timezone_offset, first_date, start=0.0, end=0.0)

Description:
a method to retrieve summary details for a period of time

    NOTE: start and end must be no more than 30 days, 1 second apart

Argument Type Required Default Description
self objectYes None
timezone_offsetint Yes 0 integer with timezone offset from user profile details
first_date str Yes "" string with ISO date from user profile details firstDate
start float 0.0 [optional] float with starting datetime for daily summaries
end float 0.0 [optional] float with ending datetime for daily summaries

get_activities

Signature:
get_activities(self, timezone_offset, first_date, start=0.0, end=0.0)

Description:
a method to retrieve activity details for a period of time

    NOTE: start and end must be no more than 30 days, 1 second apart

Argument Type Required Default Description
self objectYes None
timezone_offsetint Yes 0 integer with timezone offset from user profile details
first_date str Yes "" string with ISO date from user profile details firstDate
start float 0.0 [optional] float with starting datetime for daily summaries
end float 0.0 [optional] float with ending datetime for daily summaries

get_places

Signature:
get_places(self, timezone_offset, first_date, start=0.0, end=0.0)

Description:
a method to retrieve place details for a period of time

    NOTE: start and end must be no more than 30 days, 1 second apart

Argument Type Required Default Description
self objectYes None
timezone_offsetint Yes 0 integer with timezone offset from user profile details
first_date str Yes "" string with ISO date from user profile details firstDate
start float 0.0 [optional] float with starting datetime for daily summaries
end float 0.0 [optional] float with ending datetime for daily summaries

get_storyline

Signature:
get_storyline(self, timezone_offset, first_date, start=0.0, end=0.0, track_points=False)

Description:
a method to retrieve storyline details for a period of time

    NOTE: start and end must be no more than 30 days, 1 second apart

    NOTE: if track_points=True, start and end must be no more than 6 days, 1 second apart

Argument Type Required Default Description
self objectYes None
timezone_offsetint Yes 0 integer with timezone offset from user profile details
first_date str Yes "" string with ISO date from user profile details firstDate
start float 0.0 [optional] float with starting datetime for daily summaries
end float 0.0 [optional] float with ending datetime for daily summaries
track_points bool False [optional] boolean to provide detailed tracking of user movement

iamClient

Import:

labpack.authentication.aws.iam.iamClient

Description:

a class of methods for interacting with the AWS Identity & Access Management

    https://boto3.readthedocs.org/en/latest/

__init__

Signature:
__init__(self, access_id, secret_key, region_name, owner_id, user_name, verbose=True)

Description:
a method for initializing the connection to AW IAM

Argument Type Required Default Description
self objectYes None
access_id str Yes "" string with access_key_id from aws IAM user setup
secret_key str Yes "" string with secret_access_key from aws IAM user setup
region_namestr Yes "" string with name of aws region
owner_id str Yes "" string with aws account id
user_name str Yes "" string with name of user access keys are assigned to
verbose bool True boolean to enable process messages

list_certificates

Signature:
list_certificates(self)

Description:
a method to retrieve a list of server certificates

read_certificate

Signature:
read_certificate(self, certificate_name)

Description:
a method to retrieve the details about a server certificate

Argument Type Required Default Description
self objectYes None
certificate_namestr Yes "" string with name of server certificate

list_roles

Signature:
list_roles(self)

Description:
a method to retrieve a list of server certificates

oauth2Client

Import:

labpack.authentication.oauth2.oauth2Client

Description:

the initialization method for oauth2 client class

__init__

Signature:
__init__(self, client_id, client_secret, auth_endpoint, token_endpoint, redirect_uri, request_mimetype=”“, status_endpoint=”“, requests_handler=None, error_map=None)

Description:
the initialization method for oauth2 client class

Argument Type Required Default Description
self object Yes None
client_id str Yes "" string with client id registered for app with service
client_secret str Yes "" string with client secret registered for app with service
auth_endpoint str Yes "" string with service endpoint for authorization code requests
token_endpoint str Yes "" string with service endpoint for token post requests
redirect_uri str Yes "" string with url for redirect callback registered with service
request_mimetypestr "" [optional] string with mimetype for token post requests
status_endpoint str "" [optional] string with service endpoint to retrieve status of token
requests_handlerfunction None [optional] callable that handles requests errors
error_map dict None [optional] dictionary with key value strings for service error msgs

generate_url

Signature:
generate_url(self, service_scope=None, state_value=”“, additional_fields=None)

Description:
a method to generate an authorization url to oauth2 service for client

Argument Type Required Default Description
self objectYes None
service_scope list None [optional] list with scope of permissions for agent
state_value str "" [optional] string with unique identifier for callback
additional_fieldsdict None [optional] dictionary with key value strings for service

get_token

Signature:
get_token(self, auth_code)

Description:
a method to retrieve an access token from an oauth2 authorizing party

Argument Type Required Default Description
self objectYes None
auth_code str Yes "" string with code provided by client redirect

renew_token

Signature:
renew_token(self, refresh_token)

Description:
a method to renew an access token from an oauth2 authorizing party

Argument Type Required Default Description
self object Yes None
refresh_tokenNoneTypeYes None

depositsClient

Import:

labpack.banking.capitalone.depositsClient

Description:

a class to manage the capital one bank account starter api

https://developer.capitalone.com/products/bank-account-starter/documentation/

NOTE:   WIP

__init__

Signature:
__init__(self, client_id, client_secret, retrieve_details=True, sandbox=False, requests_handler=None, usage_client=None)

Description:
the initialization method for the capital one client

Argument Type Required Default Description
self object Yes None
client_id str Yes "" string with client id registered for app with service
client_secret str Yes "" string with client secret registered for app with service
retrieve_detailsbool True boolean to automatically retrieve, store and refresh account details
sandbox bool False boolean to send requests to test sandbox
requests_handlerfunction None callable that handles requests errors
usage_client function None callable that records usage data

access_token

Signature:
access_token(self)

Description:
a method to acquire an oauth access token

account_products

Signature:
account_products(self)

Description:
a method to retrieve a list of the account products

        returns:
        { 
            "error": "",
            "code": 200,
            "method": "GET",
            "url": "https://...",
            "headers": { },
            "json": {
              "entries": [
                {
                  "productId": "3000",
                  "productName": "Capital One 360 Savings Account"
                }
              ]
            }
        }

account_product

Signature:
account_product(self, product_id)

Description:
a method to retrieve details about a particular account product

    { 
        "error": "",
        "code": 200,
        "method": "GET",
        "url": "https://...",
        "headers": { },
        "json": {
          "productId": "3300",
          "productName": "Capital One 360 Money Market Account",
          "cdTerms": [
            "12M"
          ],
          "annualPercentageYieldDetails": {
            "annualPercentageYieldType": "simple",
            "annualPercentageYield": 1.4,
            "tieredAnnualPercentageYield": [
              {
                "tierDescription": "$0 - $9,999.99",
                "annualPercentageYield": 1.4
              }
            ],
            "termBasedAnnualPercentageYield": [
              {
                "term": "6M",
                "annualPercentageYield": 1.2
              }
            ]
          },
          "disclosures": {
            "productDisclosureUrl": "https://www.capitalone.com/savings-accounts/online-savings-account/disclosures/#360savingsdisclosure",
            "termsAndConditionsUrl": "https://www.capitalone.com/online-money-market-account/disclosures/#360moneymarketagreement",
            "electronicFundTransferDisclosureUrl": "https://www.capitalone.com/cds/online-cds/disclosures/#electronicfundtransferdisclosurestatement",
            "privacyPolicyUrl": "https://www.capitalone.com/savings-accounts/online-savings-account/disclosures/#privacypolicy",
            "wireTransferAgreementUrl": "https://www.capitalone.com/savings-accounts/online-savings-account/disclosures/#wirefundstransferdisclosurestatement",
            "paperlessAgreementUrl": "https://www.capitalone.com/terms_eddn",
            "fraudProtectionAgreementUrl": "https://www.capitalone.com/terms-personal-data",
            "tcpaDisclosureContent": "If number(s) provided above is(are) mobile phone number(s), it is (they are) my mobile phone number(s), by clicking on the button below, I consent to receive autodialed and prerecorded/artificial calls , including texts, relating to my relationship with Capital One (which may include handling, servicing, and billing for any of my accounts). Message and Data rates may apply. You can stop these types of messages by replying STOP in response to a text message, or by following any other instructions contained in the time-sensitive call.\n[Radio button] You can call or text me through automated means\n[Radio button] You can only contact me through non-automated mean"
          }
        }
    }

Argument Type Required Default Description
self object Yes None
product_idNoneTypeYes None

account_application

Signature:
account_application(self, customer_ip, first_name, last_name, tax_id, date_of_birth, address_line_1, city_name, state_code, postal_code, phone_number, email_address, citizenship_country, employment_status, product_id, funding_amount, account_number, routing_number, backup_withholding=False, phone_type=”mobile”, accept_tcpa=False, accept_terms=True, address_line_2=”“, middle_name=”“, tax_id_type=”SSN”, secondary_citizenship_country=”“, job_title=”“, annual_income=0, cd_term=”“, funding_type=”fundach”, account_owner=”primary”, secondary_application=None)

Description:
a method to submit application for new account

Argument Type Required Default Description
self objectYes None
customer_ip str Yes "" string with ip address of applicant
first_name str Yes "" string with first name of applicant
last_name str Yes "" string with last name of applicant
tax_id str Yes "" string with tax id number of applicant
date_of_birth str Yes "" string with ISO format of date of birth of applicant
address_line_1 str Yes "" string with first line of street address of applicant
city_name str Yes "" string with name of city of address of applicant
state_code str Yes "" string with code for the state of address of applicant
postal_code str Yes "" string with postal code of address of applicant
phone_number str Yes "" string with phone number and area code of applicant
email_address str Yes "" string with email address of applicant
citizenship_country str Yes "" string with ISO 3166 alpha-3 country code of citizenship of applicant
employment_status str Yes "" string with employment status of applicant
product_id int Yes 0 integer with id of account product to apply for
funding_amount float Yes 0.0 float with amount of dollars to initially fund account
account_number str Yes "" string with pre-existing bank account number of applicant
routing_number str Yes "" string with aba routing number for bank of pre-existing account of applicant
backup_withholding bool False [optional] boolean to indicate backup withholding on accounts of applicant
phone_type str "mobile" [optional] string with type of phone of applicant
accept_tcpa bool False boolean to accept to be contacted by citizen one marketing on their phone number
accept_terms bool True boolean to accept the terms and conditions associated with new account
address_line_2 str "" [optional] string with second line of address of applicant
middle_name str "" [optional] string with middle name of applicant
tax_id_type str "SSN" string with type of tax id of applicant
secondary_citizenship_countrystr "" [optional] string with ISO 3166 alpha-3 country code of secondary citizenship
job_title str "" [optional] string with job title of applicant
annual_income int 0 [optional] integer with dollar value of annual income of applicant
cd_term str "" [optional] string with term for the cd account product to apply for
funding_type str "fundach"string with funding method selected by the applicant to fund new account
account_owner str "primary"string with role of applicant who owns pre-existing bank account
secondary_application dict None dictionary with applicant fields of secondary account holder

wallet_questions

Signature:
wallet_questions(self, application_id, customer_ip)

Description:

Argument Type Required Default Description
self object Yes None
application_idNoneTypeYes None
customer_ip NoneTypeYes None

wallet_answers

Signature:
wallet_answers(self, application_id, customer_ip, answer_dict)

Description:

Argument Type Required Default Description
self object Yes None
application_idNoneTypeYes None
customer_ip NoneTypeYes None
answer_dict NoneTypeYes None

application_details

Signature:
application_details(self)

Description:

syncGatewayClient

Import:

labpack.databases.couchbase.syncGatewayClient

Description:

the initialization method for syncGatewayAdmin class

__init__

Signature:
__init__(self, bucket_name, database_url, document_schema=None, verbose=False, public=False, configs=None)

Description:
the initialization method for syncGatewayAdmin class

Argument Type Required Default Description
self object Yes None
bucket_name NoneTypeYes None
database_url NoneTypeYes None
document_schemaNoneType None
verbose bool False
public bool False
configs NoneType None

create_view

Signature:
create_view(self, query_criteria=None, uid=”_all_users”)

Description:
a method to add a view to a design document of a uid

Argument Type Required Default Description
self objectYes None
query_criteriadict None dictionary with valid jsonmodel query criteria
uid str "_all_users"[optional] string with uid of design document to update

delete_view

Signature:
delete_view(self, query_criteria=None, uid=”_all_users”)

Description:
a method to delete a view associated with a user design doc

Argument Type Required Default Description
self objectYes None
query_criteriadict None [optional] dictionary with valid jsonmodel query criteria
uid str "_all_users"[optional] string with uid of design document to update

list_users

Signature:
list_users(self)

Description:
a method to list all the user ids of all users in the bucket

save_user

Signature:
save_user(self, uid, user_password, user_email=”“, user_channels=None, user_roles=None, user_views=None, disable_account=False)

Description:
a method to add or update an authorized user to the bucket

Argument Type Required Default Description
self objectYes None
uid str Yes "" string with id to assign to user
user_password str Yes "" string with password to assign to user
user_email str "" [optional] string with email of user for future lookup
user_channels list None [optional] list of strings with channels to subscribe to user
user_roles list None [optional] list of strings with roles to assign to user
user_views list None [optional] list of query criteria to create as views for user
disable_accountbool False boolean to disable access to records by user

load_user

Signature:
load_user(self, uid)

Description:
a method to retrieve the account details of a user in the bucket

Argument Type Required Default Description
self objectYes None
uid str Yes "" string with id of user in bucket

delete_user

Signature:
delete_user(self, uid, delete_views=True)

Description:
a method to retrieve the account details of a user in the bucket

Argument Type Required Default Description
self objectYes None
uid str Yes "" string with id of user in bucket
delete_viewsbool True boolean to remove indices attached to user

create_session

Signature:
create_session(self, uid, duration=0)

Description:
a method to create a session token for the user

Argument Type Required Default Description
self objectYes None
uid str Yes "" string with id of user in bucket
duration int 0 integer with number of seconds to last (default: 24hrs)

delete_session

Signature:
delete_session(self, session_id)

Description:
a method to create a session token for the user

Argument Type Required Default Description
self objectYes None
session_idstr Yes "" string with id of user session token in bucket

delete_sessions

Signature:
delete_sessions(self, uid)

Description:
a method to delete all session tokens associated with a user

Argument Type Required Default Description
self objectYes None
uid str Yes "" string with id of user in bucket

exists

Signature:
exists(self, doc_id, rev_id=”“)

Description:
a method to determine if document exists

Argument Type Required Default Description
self objectYes None
doc_id str Yes "" string with id of document in bucket
rev_id str "" [optional] string with revision id of document in bucket

list

Signature:
list(self, query_criteria=None, uid=”_all_users”, all_versions=False, previous_id=”“, purge_deleted=False)

Description:
a generator method for retrieving documents from the bucket

Argument Type Required Default Description
self objectYes None
query_criteriadict None [optional] dictionary with valid jsonmodel query criteria
uid str "_all_users"[optional] string with uid of design document to update
all_versions bool False boolean to include previous revisions in query
previous_id str "" [optional] string with id of the last doc in a previous query
purge_deleted bool False boolean to purge any files in results which have been deleted

create

Signature:
create(self, doc_details)

Description:
a method to create a new document in the collection

Argument Type Required Default Description
self objectYes None
doc_detailsdict Yes None dictionary with document details and user id value

read

Signature:
read(self, doc_id, rev_id=”“)

Description:

Argument Type Required Default Description
self object Yes None
doc_id NoneTypeYes None
rev_id str ""

update

Signature:
update(self, doc_details)

Description:

Argument Type Required Default Description
self object Yes None
doc_detailsNoneTypeYes None

delete

Signature:
delete(self, doc_id, rev_id)

Description:
a method to mark a document for deletion

Argument Type Required Default Description
self objectYes None
doc_id str Yes "" string with id of document in bucket
rev_id str Yes "" string with revision id of document in bucket

purge

Signature:
purge(self, doc_ids)

Description:
a method to remove docs from the collection

Argument Type Required Default Description
self objectYes None
doc_ids str Yes "" string or list of strings with document ids to purge

remove

Signature:
remove(self)

Description:
a method to remove the entire bucket from the database

export

Signature:
export(self)

Description:

sqlClient

Import:

labpack.databases.sql.sqlClient

Description:

a class of methods for storing json valid records in a sql database

__init__

Signature:
__init__(self, table_name, database_url, record_schema, rebuild=True, verbose=False)

Description:
the initialization method for the sqlClient class

Argument Type Required Default Description
self objectYes None
table_name str Yes "" string with name for table of records
database_url str Yes "" string with unique resource identifier to database
record_schemadict Yes None dictionary with jsonmodel valid schema for records
rebuild bool True [optional] boolean to rebuild table with schema changes
verbose bool False [optional] boolean to enable database logging to stdout

exists

Signature:
exists(self, primary_key)

Description:
a method to determine if record exists

Argument Type Required Default Description
self objectYes None
primary_keystr Yes "" string with primary key of record

list

Signature:
list(self, query_criteria=None, order_criteria=None)

Description:
a generator method to list records in table which match query criteria

Argument Type Required Default Description
self objectYes None
query_criteriadict None dictionary with schema dot-path field names and query qualifiers
order_criterialist None list of single keypair dictionaries with field names to order by

create

Signature:
create(self, record_details)

Description:
a method to create a new record in the table

        NOTE:   this class uses the id key as the primary key for all records
                if record_details includes an id field that is an integer, float
                or string, then it will be used as the primary key. if the id
                field is missing, a unique 24 character url safe string will be 
                created for the id field and included in the record_details

        NOTE:   record_details fields which do not exist in the record_model
                or whose value do not match the requirements of the record_model
                will throw an InputValidationError

        NOTE:   lists fields are pickled before they are saved to disk and
                are not possible to search using sql query statements. it is
                recommended that lists be stored instead as separate tables

Argument Type Required Default Description
self objectYes None
record_detailsdict Yes None dictionary with record fields

read

Signature:
read(self, primary_key)

Description:
a method to retrieve the details for a record in the table

Argument Type Required Default Description
self objectYes None
primary_keystr Yes "" string with primary key of record

update

Signature:
update(self, new_details, old_details=None)

Description:
a method to upsert changes to a record in the table

Argument Type Required Default Description
self objectYes None
new_detailsdict Yes None dictionary with updated record fields
old_detailsdict None [optional] dictionary with original record fields

delete

Signature:
delete(self, primary_key)

Description:
a method to delete a record in the table

Argument Type Required Default Description
self objectYes None
primary_keystr Yes "" string with primary key of record

remove

Signature:
remove(self)

Description:
a method to remove the entire table

    :return string with status message

export

Signature:
export(self, sql_client, merge_rule=”skip”, coerce=False)

Description:
a method to export all the records in table to another table

Argument Type Required Default Description
self objectYes None
sql_clienttype Yes None class object with sql client methods
merge_rulestr "skip" string with name of rule to adopt for pre-existing records
coerce bool False boolean to enable migration even if table schemas don't match

mailgunClient

Import:

labpack.email.mailgun.mailgunClient

Description:

a class of methods for managing email with mailgun api

__init__

Signature:
__init__(self, api_key, email_key, account_domain, usage_client=None, requests_handler=None)

Description:
initialization method for mailgun client class

Argument Type Required Default Description
self object Yes None
api_key str Yes "" string with api key provided by mailgun
email_key str Yes "" string with email validation key provide by mailgun
account_domain str Yes "" string with domain from which to send email
usage_client function None callable that records usage data
requests_handlerfunction None callable that handles requests errors

send_email

Signature:
send_email(self, recipient_list, sender_email, sender_name, email_subject, content_text=”“, content_html=”“, tracking_tags=None, cc_list=None, bcc_list=None, delivery_time=0.0)

Description:

Argument Type Required Default Description
self object Yes None
recipient_listNoneTypeYes None
sender_email NoneTypeYes None
sender_name NoneTypeYes None
email_subject NoneTypeYes None
content_text str ""
content_html str ""
tracking_tags NoneType None
cc_list NoneType None
bcc_list NoneType None
delivery_time float 0.0

validate_email

Signature:
validate_email(self, email_address)

Description:
a method to validate an email address

Argument Type Required Default Description
self objectYes None
email_addressstr Yes "" string with email address to validate

mandrillClient

Import:

labpack.email.mandrill.mandrillClient

Description:

a class of methods for sending emails through the mandrill api

__init__

Signature:
__init__(self, api_key, allow_fees=False, usage_client=None, requests_handler=None)

Description:
a method to initialize the mandrill client class

Argument Type Required Default Description
self object Yes None
api_key str Yes "" string with api key generated by mandrill
allow_fees bool False [optional] boolean to allow additional fees
usage_client function None callable that records usage data
requests_handlerfunction None callable that handles requests errors

send_email

Signature:
send_email(self, recipient_list, sender_email, sender_name, email_subject, content_text=”“, content_html=”“, tracking_tags=None, cc_list=None, bcc_list=None, delivery_time=0.0)

Description:

Argument Type Required Default Description
self object Yes None
recipient_listNoneTypeYes None
sender_email NoneTypeYes None
sender_name NoneTypeYes None
email_subject NoneTypeYes None
content_text str ""
content_html str ""
tracking_tags NoneType None
cc_list NoneType None
bcc_list NoneType None
delivery_time float 0.0

meetupClient

Import:

labpack.events.meetup.meetupClient

Description:

a class of methods for managing user events, groups and profile on Meetup API

__init__

Signature:
__init__(self, access_token, service_scope, usage_client=None, requests_handler=None)

Description:
initialization method for meetup client class

Argument Type Required Default Description
self object Yes None
access_token str Yes "" string with access token for user provided by meetup oauth
service_scope dict Yes None dictionary with service type permissions
usage_client function None [optional] callable that records usage data
requests_handlerfunction None [optional] callable that handles requests errors

get_member_brief

Signature:
get_member_brief(self, member_id=0)

Description:
a method to retrieve member profile info

Argument Type Required Default Description
self objectYes None
member_id int 0 [optional] integer with member id from member profile

get_member_profile

Signature:
get_member_profile(self, member_id)

Description:
a method to retrieve member profile details

Argument Type Required Default Description
self objectYes None
member_id int Yes 0 integer with member id from member profile

update_member_profile

Signature:
update_member_profile(self, brief_details, profile_details)

Description:
a method to update user profile details on meetup

Argument Type Required Default Description
self objectYes None
brief_details dict Yes None dictionary with member brief details with updated values
profile_detailsdict Yes None dictionary with member profile details with updated values

list_member_topics

Signature:
list_member_topics(self, member_id)

Description:
a method to retrieve a list of topics member follows

Argument Type Required Default Description
self objectYes None
member_id int Yes 0 integer with meetup member id

list_member_groups

Signature:
list_member_groups(self, member_id)

Description:
a method to retrieve a list of meetup groups member belongs to

Argument Type Required Default Description
self objectYes None
member_id int Yes 0 integer with meetup member id

list_member_events

Signature:
list_member_events(self, upcoming=True)

Description:
a method to retrieve a list of events member attended or will attend

Argument Type Required Default Description
self objectYes None
upcoming bool True [optional] boolean to filter list to only future events

get_member_calendar

Signature:
get_member_calendar(self, max_results=0)

Description:
a method to retrieve the upcoming events for all groups member belongs to

Argument Type Required Default Description
self objectYes None
max_resultsint 0 [optional] integer with number of events to include

list_groups

Signature:
list_groups(self, topics=None, categories=None, text=”“, country_code=”“, latitude=0.0, longitude=0.0, location=”“, radius=0.0, zip_code=”“, max_results=0, member_groups=True)

Description:
a method to find meetup groups based upon a number of filters

Argument Type Required Default Description
self object Yes None
topics list None [optional] list of integer meetup ids for topics
categories NoneType None
text str "" [optional] string with words in groups to search
country_code str "" [optional] string with two character country code
latitude float 0.0 [optional] float with latitude coordinate at center of geo search
longitude float 0.0 [optional] float with longitude coordinate at center of geo search
location str "" [optional] string with meetup location name fields to search
radius float 0.0 [optional] float with distance from center of geographic search
zip_code str "" [optional] string with zip code of geographic search
max_results int 0 [optional] integer with number of groups to include
member_groupsbool True [optional] boolean to include groups member belongs to

get_group_details

Signature:
get_group_details(self, group_url=”“, group_id=0)

Description:
a method to retrieve details about a meetup group

Argument Type Required Default Description
self objectYes None
group_url str "" string with meetup urlname of group
group_id int 0 int with meetup id for group

list_group_events

Signature:
list_group_events(self, group_url, upcoming=True)

Description:
a method to retrieve a list of upcoming events hosted by group

Argument Type Required Default Description
self objectYes None
group_url str Yes "" string with meetup urlname field of group
upcoming bool True [optional] boolean to filter list to only future events

list_group_members

Signature:
list_group_members(self, group_url, max_results=0)

Description:
a method to retrieve a list of members for a meetup group

Argument Type Required Default Description
self objectYes None
group_url str Yes "" string with meetup urlname for group
max_resultsint 0 [optional] integer with number of members to include

get_event_details

Signature:
get_event_details(self, group_url, event_id)

Description:
a method to retrieve details for an event

Argument Type Required Default Description
self objectYes None
group_url str Yes "" string with meetup urlname for host group
event_id int Yes 0 integer with meetup id for event

list_event_attendees

Signature:
list_event_attendees(self, group_url, event_id)

Description:
a method to retrieve attendee list for event from meetup api

Argument Type Required Default Description
self objectYes None
group_url str Yes "" string with meetup urlname for host group
event_id int Yes 0 integer with meetup id for event

get_venue_details

Signature:
get_venue_details(self, venue_id)

Description:
a method to retrieve venue details from meetup api

Argument Type Required Default Description
self objectYes None
venue_id int Yes 0 integer for meetup id for venue

list_locations

Signature:
list_locations(self, latitude=0.0, longitude=0.0, zip_code=”“, city_name=”“, max_results=0)

Description:
a method to retrieve location address details based upon search parameters

Argument Type Required Default Description
self objectYes None
latitude float 0.0 [optional] float with latitude coordinate at center of geo search
longitude float 0.0 [optional] float with longitude coordinate at center of geo search
zip_code str "" [optional] string with zip code of geographic search
city_name str "" [optional] string with name of city for search
max_resultsint 0 [optional] integer with number of groups to include

join_group

Signature:
join_group(self, group_url, membership_answers=None)

Description:
a method to add member to a meetup group

Argument Type Required Default Description
self objectYes None
group_url str Yes "" string with meetup urlname for group
membership_answerslist None list with question id and answer for group join questions

leave_group

Signature:
leave_group(self, group_url, member_id, exit_comment=”“)

Description:
a method to remove group from meetup member profile

Argument Type Required Default Description
self objectYes None
group_url str Yes "" string with meetup urlname for group
member_id int Yes 0 integer with member id from member profile
exit_commentstr "" string with comment to leave with organizer

join_topics

Signature:
join_topics(self, member_id, topics)

Description:
a method to add topics to member profile details on meetup

Argument Type Required Default Description
self objectYes None
member_id int Yes 0 integer with member id from member profile
topics list Yes None list of integer meetup ids for topics

leave_topics

Signature:
leave_topics(self, member_id, topics)

Description:
a method to remove topics from member profile details on meetup

Argument Type Required Default Description
self objectYes None
member_id int Yes 0 integer with member id from member profile
topics list Yes None list of integer meetup ids for topics

join_event

Signature:
join_event(self, group_url, event_id, additional_guests=0, attendance_answers=None, payment_service=”“, payment_code=”“)

Description:
a method to create an rsvp for a meetup event

Argument Type Required Default Description
self objectYes None
group_url str Yes "" string with meetup urlname for group
event_id int Yes 0 integer with meetup id for event
additional_guests int 0 [optional] integer with number of additional guests
attendance_answerslist None [optional] list with id & answer for event survey questions
payment_service str "" [optional] string with name of payment service to use
payment_code str "" [optional] string with token to authorize payment

leave_event

Signature:
leave_event(self, group_url, event_id)

Description:
a method to rescind an rsvp to a meetup event

Argument Type Required Default Description
self objectYes None
group_url str Yes "" string with meetup urlname for group
event_id int Yes 0 integer with meetup id for event

findClient

Import:

labpack.location.find.findClient

Description:

a method to initialize a findClient class object

__init__

Signature:
__init__(self, group_name, server_url=”ml.internalpositioning.com”, password=”“)

Description:
a method to initialize a findClient class object

Argument Type Required Default Description
self objectYes None
group_namestr Yes "" string with name of group
server_urlstr "ml.internalpositioning.com"string with url for FIND server
password str "" [optional] string with password to mosquitto server

get_password

Signature:
get_password(self)

Description:
a method to retrieve the password for the group mosquitto server

get_locations

Signature:
get_locations(self)

Description:
a method to retrieve all the locations tracked by the model

update_model

Signature:
update_model(self)

Description:
a method to update model with latest training data

get_position

Signature:
get_position(self, user_id, track=False, confidence=False)

Description:
a method to retrieve the latest position of a user

Argument Type Required Default Description
self objectYes None
user_id str Yes "" string with id of user
track bool False [optional] boolean to add user to self.positions
confidencebool False [optional] boolean to include the data model confidence scores

get_positions

Signature:
get_positions(self, user_id, history=1, confidence=False)

Description:
a method to retrieve the position history of a user

Argument Type Required Default Description
self objectYes None
user_id str Yes "" string with id of user
history int 1 [optional] integer with length of previous positions to retrieve
confidencebool False [optional] boolean to include the data model confidence scores

update_positions

Signature:
update_positions(self)

Description:
a method to update the latest position of all users being tracked

subscribe

Signature:
subscribe(self, callable=None, block=False, port=1883)

Description:
a method to establish a mosquitto socket with server to receive position updates

Argument Type Required Default Description
self object Yes None
callable function None [optional] callable to process the received positions
block bool False [optional] boolean to block the main thread when method is called
port int 1883 [optional] integer with port to connect to

publish

Signature:
publish(self, user_id, wifi_fingerprint, action=”track”, location_id=”“, port=1883)

Description:
a method to publish wifi fingerprint data to a mosquitto server

Argument Type Required Default Description
self objectYes None
user_id str Yes "" string with id of user
wifi_fingerprintlist Yes None list of dictionaries with wifi fields mac and rssi
action str "track" string with type of action to perform with data (track or learn)
location_id str "" [optional] string with classifier to add to learning data
port int 1883 [optional] integer with port to connect to

telegramBotClient

Import:

labpack.messaging.telegram.telegramBotClient

Description:

a class of methods for interacting with telegram bot api

__init__

Signature:
__init__(self, bot_id, access_token, requests_handler=None)

Description:
initialization method for moves client class

Argument Type Required Default Description
self object Yes None
bot_id int Yes 0 integer with telegram id number for bot
access_token str Yes "" string with access token for bot provided by telegram botfather
requests_handlerfunction None callable that handles requests errors

get_me

Signature:
get_me(self)

Description:
a method to retrieve details about the bot from telegram api

set_webhook

Signature:
set_webhook(self, webhook_url, certificate_id=”“, certificate_path=”“, certificate_url=”“, max_connections=40)

Description:

Argument Type Required Default Description
self object Yes None
webhook_url NoneTypeYes None
certificate_id str ""
certificate_pathstr ""
certificate_url str ""
max_connections int 40

delete_webhook

Signature:
delete_webhook(self)

Description:

get_updates

Signature:
get_updates(self, last_update=0)

Description:
a method to retrieve messages for bot from telegram api

Argument Type Required Default Description
self objectYes None
last_updateint 0 integer with update id of last message received

get_route

Signature:
get_route(self, file_id)

Description:
a method to retrieve route information for file on telegram api

Argument Type Required Default Description
self objectYes None
file_id str Yes "" string with id of file in a message send to bot

get_file

Signature:
get_file(self, file_route, file_name=”“)

Description:
a method to retrieve data for a file housed on telegram api

Argument Type Required Default Description
self objectYes None
file_routestr Yes "" string with route to file endpoint on telegram api
file_name str ""

send_message

Signature:
send_message(self, user_id, message_text, message_style=”“, button_list=None, small_buttons=True, persist_buttons=False, link_preview=True)

Description:
a method to send a message using telegram api

Argument Type Required Default Description
self objectYes None
user_id int Yes 0 integer with id of telegram user
message_text str Yes "" string with message to user
message_style str "" [optional] string with style to apply to text, only 'markdown'
button_list list None [optional] list of string to include as buttons in message
small_buttons bool True [optional] boolean to resize buttons to single line
persist_buttonsbool False [optional] boolean to keep buttons around after exiting
link_preview bool True [optional] boolean to open up a preview window of a link in message

send_photo

Signature:
send_photo(self, user_id, photo_id=”“, photo_path=”“, photo_url=”“, caption_text=”“, button_list=None, small_buttons=True, persist_buttons=False)

Description:
a method to send a photo using telegram api

Argument Type Required Default Description
self object Yes None
user_id int Yes 0 integer with id of telegram user
photo_id str "" [optional] string with id of file stored with telegram api
photo_path str "" [optional] string with local path to file
photo_url str "" [optional] string with url of file
caption_text str "" [optional] string with caption to add to photo
button_list NoneType None
small_buttons bool True
persist_buttonsbool False

send_voice

Signature:
send_voice(self, user_id, voice_id=”“, voice_path=”“, voice_url=”“, caption_text=”“, button_list=None, small_buttons=True, persist_buttons=False)

Description:

Argument Type Required Default Description
self object Yes None
user_id NoneTypeYes None
voice_id str ""
voice_path str ""
voice_url str ""
caption_text str ""
button_list NoneType None
small_buttons bool True
persist_buttonsbool False

twilioClient

Import:

labpack.messaging.twilio.twilioClient

Description:

send an SMS from the Twilio account to phone number

__init__

Signature:
__init__(self, account_sid, auth_token, twilio_phone)

Description:

Argument Type Required Default Description
self object Yes None
account_sid NoneTypeYes None
auth_token NoneTypeYes None
twilio_phoneNoneTypeYes None

send_message

Signature:
send_message(self, phone_number, message_text)

Description:
send an SMS from the Twilio account to phone number

Argument Type Required Default Description
self objectYes None
phone_numberstr Yes "" string with phone number with country and area code
message_textstr Yes "" string with message text

apschedulerClient

Import:

labpack.platforms.apscheduler.apschedulerClient

Description:

initialization method for apschedulerClient class

__init__

Signature:
__init__(self, scheduler_url, requests_handler=None)

Description:
initialization method for apschedulerClient class

Argument Type Required Default Description
self object Yes None
scheduler_url str Yes "" string with url of scheduler service
requests_handlerfunction None [optional] callable for handling requests errors

get_info

Signature:
get_info(self)

Description:

list_jobs

Signature:
list_jobs(self, argument_filters=None)

Description:
a method to list jobs in the scheduler

Argument Type Required Default Description
self objectYes None
argument_filterslist None list of query criteria dictionaries for class argument keys

add_date_job

Signature:
add_date_job(self, id, function, args=None, kwargs=None, dt=0.0, name=”“)

Description:

Argument Type Required Default Description
self object Yes None
id NoneTypeYes None
function NoneTypeYes None
args NoneType None
kwargs NoneType None
dt float 0.0
name str ""

add_interval_job

Signature:
add_interval_job(self, id, function, interval, args=None, kwargs=None, start=0.0, end=0.0, name=”“)

Description:

Argument Type Required Default Description
self object Yes None
id NoneTypeYes None
function NoneTypeYes None
interval NoneTypeYes None
args NoneType None
kwargs NoneType None
start float 0.0
end float 0.0
name str ""

add_cron_job

Signature:
add_cron_job(self, id, function, month=None, day=None, weekday=None, hour=None, minute=None, second=None, args=None, kwargs=None, start=0.0, end=0.0, name=”“)

Description:

Argument Type Required Default Description
self object Yes None
id NoneTypeYes None
function NoneTypeYes None
month NoneType None
day NoneType None
weekday NoneType None
hour NoneType None
minute NoneType None
second NoneType None
args NoneType None
kwargs NoneType None
start float 0.0
end float 0.0
name str ""

delete_job

Signature:
delete_job(self, id)

Description:

Argument Type Required Default Description
self object Yes None
id NoneTypeYes None

ec2Client

Import:

labpack.platforms.aws.ec2.ec2Client

Description:

a class of methods for interacting with AWS Elastic Computing Cloud

    https://boto3.readthedocs.org/en/latest/

__init__

Signature:
__init__(self, access_id, secret_key, region_name, owner_id, user_name, verbose=True)

Description:
a method for initializing the connection to EC2

Argument Type Required Default Description
self objectYes None
access_id str Yes "" string with access_key_id from aws IAM user setup
secret_key str Yes "" string with secret_access_key from aws IAM user setup
region_namestr Yes "" string with name of aws region
owner_id str Yes "" string with aws account id
user_name str Yes "" string with name of user access keys are assigned to
verbose bool True boolean to enable process messages

check_instance_state

Signature:
check_instance_state(self, instance_id, wait=True)

Description:
method for checking the state of an instance on AWS EC2

Argument Type Required Default Description
self objectYes None
instance_idstr Yes "" string with AWS id of instance
wait bool True [optional] boolean to wait for instance while pending

check_instance_status

Signature:
check_instance_status(self, instance_id, wait=True)

Description:
a method to wait until AWS instance reports an OK status

Argument Type Required Default Description
self objectYes None
instance_idstr Yes "" string of instance id on AWS
wait bool True [optional] boolean to wait for instance while initializing

list_instances

Signature:
list_instances(self, tag_values=None)

Description:
a method to retrieve the list of instances on AWS EC2

Argument Type Required Default Description
self objectYes None
tag_valuesdict None [optional] dictionary of tag key-values pairs

read_instance

Signature:
read_instance(self, instance_id)

Description:
a method to retrieving the details of a single instances on AWS EC2

Argument Type Required Default Description
self objectYes None
instance_idstr Yes "" string of instance id on AWS

tag_instance

Signature:
tag_instance(self, instance_id, tag_list)

Description:
a method for adding or updating tags on an AWS instance

Argument Type Required Default Description
self objectYes None
instance_idstr Yes "" string of instance id on AWS
tag_list list Yes None list of single key-value pairs

create_instance

Signature:
create_instance(self, image_id, pem_file, group_ids, instance_type, volume_type=”gp2”, ebs_optimized=False, instance_monitoring=False, iam_profile=”“, tag_list=None, auction_bid=0.0)

Description:
a method for starting an instance on AWS EC2

Argument Type Required Default Description
self objectYes None
image_id str Yes "" string with aws id of image for instance
pem_file str Yes "" string with path to pem file to access image
group_ids list Yes None list with aws id of security group(s) to attach to instance
instance_type str Yes "" string with type of instance resource to use
volume_type str "gp2" string with type of on-disk storage
ebs_optimized bool False [optional] boolean to activate ebs optimization
instance_monitoringbool False [optional] boolean to active instance monitoring
iam_profile str "" [optional] string with name of iam instance profile role
tag_list list None [optional] list of single key-pair tags for instance
auction_bid float 0.0 [optional] float with dollar amount to bid for instance hour

delete_instance

Signature:
delete_instance(self, instance_id)

Description:
method for removing an instance from AWS EC2

Argument Type Required Default Description
self objectYes None
instance_idstr Yes "" string of instance id on AWS

list_addresses

Signature:
list_addresses(self, tag_values=None)

Description:
a method to list elastic ip addresses associated with account on AWS

Argument Type Required Default Description
self objectYes None
tag_valuesdict None [optional] dictionary of tag key values

read_address

Signature:
read_address(self, ip_address)

Description:
a method to retrieve details about an elastic ip address associated with account on AWS

Argument Type Required Default Description
self objectYes None
ip_addressstr Yes "" string with elastic ipv4 address on ec2

assign_address

Signature:
assign_address(self, ip_address, instance_id)

Description:
a method to assign (or reassign) an elastic ip to an instance on AWS

Argument Type Required Default Description
self objectYes None
ip_address str Yes "" string with elastic ipv4 address on ec2
instance_idstr Yes "" string with aws id for running instance

check_image_state

Signature:
check_image_state(self, image_id, wait=True)

Description:
method for checking the state of an image on AWS EC2

Argument Type Required Default Description
self objectYes None
image_id str Yes "" string with AWS id of image
wait bool True [optional] boolean to wait for image while pending

list_images

Signature:
list_images(self, tag_values=None)

Description:
a method to retrieve the list of images of account on AWS EC2

Argument Type Required Default Description
self objectYes None
tag_valueslist None [optional] list of tag values

read_image

Signature:
read_image(self, image_id)

Description:
a method to retrieve the details of a single image on AWS EC2

Argument Type Required Default Description
self objectYes None
image_id str Yes "" string with AWS id of image

tag_image

Signature:
tag_image(self, image_id, tag_list)

Description:
a method for adding or updating tags on an AWS instance

Argument Type Required Default Description
self objectYes None
image_id str Yes "" string with AWS id of instance
tag_list list Yes None list of tags to add to instance

create_image

Signature:
create_image(self, instance_id, image_name, tag_list=None)

Description:
method for imaging an instance on AWS EC2

Argument Type Required Default Description
self objectYes None
instance_idstr Yes "" string with AWS id of running instance
image_name str Yes "" string with name to give new image
tag_list list None [optional] list of resources tags to add to image

delete_image

Signature:
delete_image(self, image_id)

Description:
method for removing an image from AWS EC2

Argument Type Required Default Description
self objectYes None
image_id str Yes "" string with AWS id of instance

import_image

Signature:
import_image(self, image_id, region_name)

Description:
a method to import an image from another AWS region

        https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html

        REQUIRED: aws credentials must have valid access to both regions

Argument Type Required Default Description
self objectYes None
image_id str Yes "" string with AWS id of source image
region_namestr Yes "" string with AWS region of source image

export_image

Signature:
export_image(self, image_id, region_name)

Description:
a method to add a copy of an image to another AWS region

        https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/CopyingAMIs.html

        REQUIRED: iam credentials must have valid access to both regions

Argument Type Required Default Description
self objectYes None
image_id str Yes "" string of AWS id of image to be copied
region_namestr Yes "" string of AWS region to copy image to

list_keypairs

Signature:
list_keypairs(self)

Description:
a method to discover the list of key pairs on AWS

list_subnets

Signature:
list_subnets(self, tag_values=None)

Description:
a method to discover the list of subnets on AWS EC2

Argument Type Required Default Description
self objectYes None
tag_valueslist None [optional] list of tag values

read_subnet

Signature:
read_subnet(self, subnet_id)

Description:
a method to retrieve the details about a subnet

Argument Type Required Default Description
self objectYes None
subnet_id str Yes "" string with AWS id of subnet

list_security_groups

Signature:
list_security_groups(self, tag_values=None)

Description:
a method to discover the list of security groups on AWS EC2

Argument Type Required Default Description
self objectYes None
tag_valueslist None [optional] list of tag values

read_security_group

Signature:
read_security_group(self, group_id)

Description:
a method to retrieve the details about a security group

Argument Type Required Default Description
self objectYes None
group_id str Yes "" string with AWS id of security group

cleanup

Signature:
cleanup(self)

Description:
a method for removing instances and images in unusual states

r53Client

Import:

labpack.platforms.aws.r53.r53Client

Description:

a class of methods for interacting with AWS Route 53

    https://boto3.readthedocs.org/en/latest/

__init__

Signature:
__init__(self, access_id, secret_key, region_name, owner_id, user_name, verbose=True)

Description:
a method for initializing the connection to Route 53

Argument Type Required Default Description
self objectYes None
access_id str Yes "" string with access_key_id from aws IAM user setup
secret_key str Yes "" string with secret_access_key from aws IAM user setup
region_namestr Yes "" string with name of aws region
owner_id str Yes "" string with aws account id
user_name str Yes "" string with name of user access keys are assigned to
verbose bool True boolean to enable process messages

list_zones

Signature:
list_zones(self)

Description:
a method to retrieve the list of hosted zones on AWS Route 53

list_records

Signature:
list_records(self, zone_id)

Description:
method for listing records associated with a hosted zone

Argument Type Required Default Description
self objectYes None
zone_id str Yes "" string of hosted zone id on AWS

create_record

Signature:
create_record(self, zone_id, record_fields)

Description:
method to create a record on a hosted zone on AWS Route 53 https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/route53.html#Route53.Client.change_resource_record_sets

Argument Type Required Default Description
self objectYes None
zone_id str Yes "" string of hosted zone id on AWS
record_fieldsdict Yes None dictionary with fields associated with record

update_record

Signature:
update_record(self, zone_id, record_fields)

Description:
method to update a hosted zone record on AWS Route 53 https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/route53.html#Route53.Client.change_resource_record_sets

Argument Type Required Default Description
self objectYes None
zone_id str Yes "" string of hosted zone id on AWS
record_fieldsdict Yes None dictionary with fields associated with record

delete_record

Signature:
delete_record(self, zone_id, record_fields)

Description:
method to delete a hosted zone record on AWS Route 53 https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/route53.html#Route53.Client.change_resource_record_sets

Argument Type Required Default Description
self objectYes None
zone_id str Yes "" string of hosted zone id on AWS
record_fieldsdict Yes None dictionary with fields associated with record

delete_zone

Signature:
delete_zone(self, zone_id)

Description:
method to delete zone from AWS Route 53 https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/route53.html#Route53.Client.delete_hosted_zone PLEASE NOTE: method will first remove all record types besides SOA and NS

Argument Type Required Default Description
self objectYes None
zone_id str Yes "" string of hosted zone id on AWS

rdsClient

Import:

labpack.platforms.aws.rds.rdsClient

Description:

a class of methods for interacting with AWS Relational Database Store

    https://boto3.readthedocs.org/en/latest/

__init__

Signature:
__init__(self, access_id, secret_key, region_name, owner_id, user_name, verbose=True)

Description:
a method for initializing the connection to EC2

Argument Type Required Default Description
self objectYes None
access_id str Yes "" string with access_key_id from aws IAM user setup
secret_key str Yes "" string with secret_access_key from aws IAM user setup
region_namestr Yes "" string with name of aws region
owner_id str Yes "" string with aws account id
user_name str Yes "" string with name of user access keys are assigned to
verbose bool True boolean to enable process messages

list_instances

Signature:
list_instances(self, tag_values=None)

Description:
a method to retrieve the list of instances on AWS RDS

Argument Type Required Default Description
self objectYes None
tag_valuesdict None [optional] dictionary of tag key-values pairs

delete_instance

Signature:
delete_instance(self, instance_id)

Description:
method for removing a db instance from AWS EC2

Argument Type Required Default Description
self objectYes None
instance_idstr Yes "" string of instance id on AWS

sshClient

Import:

labpack.platforms.aws.ssh.sshClient

Description:

a class of methods to run commands on an active AWS instance

    NOTE:   Make sure that VPC rules allow SSH access to your local IP
    NOTE:   SCP protocol requires SCP installed on Remote Host

__init__

Signature:
__init__(self, instance_id, pem_file, access_id, secret_key, region_name, owner_id, user_name, login_name=”“, verbose=True)

Description:
a method for initializing the SSH connection parameters to the EC2 instance

Argument Type Required Default Description
self objectYes None
instance_idstr Yes "" string with AWS id of instance
pem_file str Yes "" string with path to keypair pem file
access_id str Yes "" string with access_key_id from aws IAM user setup
secret_key str Yes "" string with secret_access_key from aws IAM user setup
region_namestr Yes "" string with name of aws region
owner_id str Yes "" string with aws account id
user_name str Yes "" string with name of user access keys are assigned to
login_name str "" [optional] string with name of login user
verbose bool True boolean to enable process messages

terminal

Signature:
terminal(self, confirmation=True)

Description:
method to open an SSH terminal inside AWS instance

Argument Type Required Default Description
self objectYes None
confirmationbool True [optional] boolean to prompt keypair confirmation

script

Signature:
script(self, commands, synopsis=True)

Description:
a method to run a list of shell command scripts on AWS instance

Argument Type Required Default Description
self objectYes None
commands list Yes None list of strings with shell commands to pass through connection
synopsis bool True [optional] boolean to simplify progress messages to one line

put

Signature:
put(self, local_path, remote_path=”“, overwrite=False, synopsis=True)

Description:
a method to copy a folder or file from local device to AWS instance

Argument Type Required Default Description
self objectYes None
local_path str Yes "" string with path to folder or file on local host
remote_pathstr "" [optional] string with path to copy contents on remote host
overwrite bool False [optional] boolean to enable file overwrite on remote host
synopsis bool True [optional] boolean to simplify progress messages to one line

get

Signature:
get(self, remote_path, local_path=”“, overwrite=False, synopsis=True)

Description:
a method to copy a folder or file from AWS instance to local device

Argument Type Required Default Description
self objectYes None
remote_pathstr Yes "" string with path to copy contents on remote host
local_path str "" [optional] string with path to folder or file on local host
overwrite bool False [optional] boolean to enable file overwrite on remote host
synopsis bool True [optional] boolean to simplify progress messages to one line

responsive

Signature:
responsive(self, port=80, timeout=600)

Description:
a method for waiting until web server on AWS instance has restarted

Argument Type Required Default Description
self objectYes None
port int 80 integer with port number to check
timeout int 600 integer with number of seconds to continue to check

dockerClient

Import:

labpack.platforms.docker.dockerClient

Description:

a method to initialize the dockerClient class

__init__

Signature:
__init__(self, virtualbox_name=”“, verbose=False)

Description:
a method to initialize the dockerClient class

Argument Type Required Default Description
self objectYes None
virtualbox_namestr "" [optional] string with name of virtualbox image
verbose bool False

images

Signature:
images(self)

Description:
a method to list the local docker images

ps

Signature:
ps(self)

Description:
a method to list the local active docker containers

network_ls

Signature:
network_ls(self)

Description:
a method to list the available networks

inspect_container

Signature:
inspect_container(self, container_alias)

Description:
a method to retrieve the settings of a container

Argument Type Required Default Description
self objectYes None
container_aliasstr Yes "" string with name or id of container

inspect_image

Signature:
inspect_image(self, image_name, image_tag=”“)

Description:
a method to retrieve the settings of an image

Argument Type Required Default Description
self objectYes None
image_namestr Yes "" string with name or id of image
image_tag str "" [optional] string with tag associated with image

rm

Signature:
rm(self, container_alias)

Description:
a method to remove an active container

Argument Type Required Default Description
self objectYes None
container_aliasstr Yes "" string with name or id of container

rmi

Signature:
rmi(self, image_id)

Description:
a method to remove an image

Argument Type Required Default Description
self object Yes None
image_id NoneTypeYes None

ip

Signature:
ip(self)

Description:
a method to retrieve the ip of system running docker

Signature:
search(self, image_name)

Description:

Argument Type Required Default Description
self object Yes None
image_nameNoneTypeYes None

build

Signature:
build(self, image_name, image_tag=”“, dockerfile_path=”./Dockerfile”)

Description:

Argument Type Required Default Description
self object Yes None
image_name NoneTypeYes None
image_tag str ""
dockerfile_pathstr "./Dockerfile"

save

Signature:
save(self, image_name, file_name, image_tag=”“)

Description:

Argument Type Required Default Description
self object Yes None
image_nameNoneTypeYes None
file_name NoneTypeYes None
image_tag str ""

command

Signature:
command(self, sys_command)

Description:
a method to run a system command in a separate shell

Argument Type Required Default Description
self objectYes None
sys_commandstr Yes "" string with docker command

synopsis

Signature:
synopsis(self, container_alias)

Description:
a method to summarize key configuration settings required for docker compose

Argument Type Required Default Description
self objectYes None
container_aliasstr Yes "" string with name or id of container

enter

Signature:
enter(self, container_alias)

Description:
a method to open up a terminal inside a running container

Argument Type Required Default Description
self objectYes None
container_aliasstr Yes "" string with name or id of container

run

Signature:
run(self, image_name, container_alias, image_tag=”“, environmental_variables=None, mapped_ports=None, mounted_volumes=None, start_command=”“, network_name=”“, run_flags=”“)

Description:
a method to start a local container

Argument Type Required Default Description
self objectYes None
image_name str Yes "" string with name or id of image
container_alias str Yes "" string with name to assign to container
image_tag str "" [optional] string with tag assigned to image
environmental_variablesdict None [optional] dictionary of envvar fields to add to container
mapped_ports dict None [optional] dictionary of port fields to map to container
mounted_volumes dict None [optional] dictionary of path fields to map to container
start_command str "" [optional] string of command (and any arguments) to run inside container
network_name str "" [optional] string with name of docker network to link container to
run_flags str "" [optional] string with additional docker options to add to container

herokuClient

Import:

labpack.platforms.heroku.herokuClient

Description:

a method to initialize the herokuClient class

__init__

Signature:
__init__(self, account_email, auth_token, verbose=True)

Description:
a method to initialize the herokuClient class

Argument Type Required Default Description
self object Yes None
account_emailNoneTypeYes None
auth_token NoneTypeYes None
verbose bool True

access

Signature:
access(self, app_subdomain)

Description:
a method to validate user can access app

Argument Type Required Default Description
self object Yes None
app_subdomainNoneTypeYes None

deploy_docker

Signature:
deploy_docker(self, dockerfile_path, virtualbox_name=”default”)

Description:
a method to deploy app to heroku using docker

Argument Type Required Default Description
self object Yes None
dockerfile_pathNoneTypeYes None
virtualbox_namestr "default"

deploy_app

Signature:
deploy_app(self, site_folder, runtime_type=”“)

Description:
a method to deploy a static html page to heroku using php

Argument Type Required Default Description
self object Yes None
site_folder NoneTypeYes None
runtime_typestr ""

localhostClient

Import:

labpack.platforms.localhost.localhostClient

Description:

a class of methods to interact with the localhost

__init__

Signature:
__init__(self)

Description:
a method to initialize a client class to interact with the localhost

app_data

Signature:
app_data(self, org_name, prod_name)

Description:
a method to retrieve the os appropriate path to user app data

    # https://www.chromium.org/user-experience/user-data-directory

Argument Type Required Default Description
self objectYes None
org_name str Yes "" string with name of product/service creator
prod_name str Yes "" string with name of product/service

walk

Signature:
walk(self, walk_root=”“, reverse_order=False, previous_file=”“)

Description:
a generator method of file paths on localhost from walk of directories

Argument Type Required Default Description
self objectYes None
walk_root str "" string with path from which to root walk of localhost directories
reverse_orderbool False boolean to determine alphabetical direction of walk
previous_filestr "" string with path of file after which to start walk

metadata

Signature:
metadata(self, file_path)

Description:
a method to retrieve the metadata of a file on the localhost

Argument Type Required Default Description
self objectYes None
file_path str Yes "" string with path to file

conditional_filter

Signature:
conditional_filter(self, metadata_filters)

Description:
a method to construct a conditional filter function for the list method

Argument Type Required Default Description
self objectYes None
metadata_filterslist Yes None list with query criteria dictionaries

list

Signature:
list(self, filter_function=None, list_root=”“, max_results=1, reverse_order=False, previous_file=”“)

Description:
a method to list files on localhost from walk of directories

Argument Type Required Default Description
self object Yes None
filter_functionfunction None (keyword arguments) function used to filter results
list_root str "" string with localhost path from which to root list of files
max_results int 1 integer with maximum number of results to return
reverse_order bool False boolean to determine alphabetical direction of walk
previous_file str "" string with absolute path of file to begin search after

pollyClient

Import:

labpack.speech.aws.polly.pollyClient

Description:

a class of methods for interacting with AWS Polly API

__init__

Signature:
__init__(self, access_id, secret_key, region_name, owner_id, user_name, verbose=True, usage_client=None)

Description:
a method for initializing the connection to AWS Polly

Argument Type Required Default Description
self object Yes None
access_id str Yes "" string with access_key_id from aws IAM user setup
secret_key str Yes "" string with secret_access_key from aws IAM user setup
region_name str Yes "" string with name of aws region
owner_id str Yes "" string with aws account id
user_name str Yes "" string with name of user access keys are assigned to
verbose bool True boolean to enable process messages
usage_clientfunction None callable object to track resource usage

synthesize

Signature:
synthesize(self, message_text, voice_id=”Nicole”, output_format=”mp3”, sample_rate=”22050”, stream_response=False)

Description:
a method to synthesize speech from text

Argument Type Required Default Description
self objectYes None
message_text str Yes "" string with text to synthesize
voice_id str "Nicole" string with name of voice id in AWS polly to use
output_format str "mp3" string with file type of audio output
sample_rate str "22050" string with the audio frequency specified in Hz
stream_responsebool False boolean to return a StreamingBody object

watsonSpeechClient

Import:

labpack.speech.watson.watsonSpeechClient

Description:

a class of methods to convert speech to text using IBM Watson api

    https://console.ng.bluemix.net/catalog/services/text-to-speech

__init__

Signature:
__init__(self, service_username, service_password, requests_handler=None, magic_file=”“)

Description:

Argument Type Required Default Description
self object Yes None
service_usernameNoneTypeYes None
service_passwordNoneTypeYes None
requests_handlerNoneType None
magic_file str ""

convert_audio

Signature:
convert_audio(self, file_path, new_mimetype, overwrite=False)

Description:
a method to convert an audio file into a different codec

Argument Type Required Default Description
self objectYes None
file_path str Yes "" string with path to file on localhost
new_mimetypestr Yes "" string with mimetype for new file
overwrite bool False [optional] boolean to overwrite existing file

transcribe_file

Signature:
transcribe_file(self, file_path, clip_length=10, compress=True)

Description:
a method to transcribe the text from an audio file

    EXAMPLE: https://github.com/dannguyen/watson-word-watcher

Argument Type Required Default Description
self objectYes None
file_path str Yes "" string with path to audio file on localhost
clip_lengthint 10 [optional] integer with seconds to divide clips into
compress bool True [optional] boolean to convert file to audio/ogg

transcribe_url

Signature:
transcribe_url(self, file_url, clip_length=0, compress=True)

Description:
a method to transcribe the text from an audio url

Argument Type Required Default Description
self object Yes None
file_url NoneTypeYes None
clip_lengthint 0 [optional] integer with seconds to divide clips into
compress bool True [optional] boolean to convert file to audio/ogg

transcribe_bytes

Signature:
transcribe_bytes(self, byte_data, clip_length=0, audio_mimetype=”“, compress=True)

Description:
a method to transcribe text from audio byte data

Argument Type Required Default Description
self object Yes None
byte_data NoneTypeYes None byte data in buffer with audio data
clip_length int 0 [optional] integer with seconds to divide clips into
audio_mimetypestr "" [optional] string with byte data mimetype
compress bool True [optional] boolean to convert file to audio/ogg

transcribe_stream

Signature:
transcribe_stream(self, data_stream)

Description:
a method to perform rolling transcription

Argument Type Required Default Description
self object Yes None
data_streamNoneTypeYes None

appdataClient

Import:

labpack.storage.appdata.appdataClient

Description:

a class of methods for managing file storage on local device in app data

    NOTE:   appdataClient is designed to store byte data, so encoding (or 
            decoding) different types of file types must be handled by the
            application prior (or after) data is saved (or loaded)

__init__

Signature:
__init__(self, collection_name=”“, prod_name=”“, org_name=”“, root_path=”“)

Description:
initialization method of appdata client class

Argument Type Required Default Description
self objectYes None
collection_namestr "" [optional] string with name of collection to store records
prod_name str "" [optional] string with name of application product
org_name str "" [optional] string with name of organization behind product
root_path str "" [optional] string with path to root of collections (defaults to user home)

exists

Signature:
exists(self, record_key)

Description:
a method to determine if a record exists in collection

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with key of record

save

Signature:
save(self, record_key, record_data, overwrite=True, secret_key=”“)

Description:
a method to create a record in the collection folder

Argument Type Required Default Description
self object Yes None
record_key str Yes "" string with name to assign to record (see NOTES below)
record_dataNoneTypeYes None byte data for record body
overwrite bool True [optional] boolean to overwrite records with same name
secret_key str "" [optional] string with key to encrypt data

load

Signature:
load(self, record_key, secret_key=”“)

Description:
a method to retrieve byte data of appdata record

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with name of record
secret_keystr "" [optional] string used to decrypt data

conditional_filter

Signature:
conditional_filter(self, path_filters)

Description:
a method to construct a conditional filter function for class list method

Argument Type Required Default Description
self objectYes None
path_filtersdict Yes None dictionary or list of dictionaries with query criteria

list

Signature:
list(self, prefix=”“, delimiter=”“, filter_function=None, max_results=1, reverse_search=True, previous_key=”“)

Description:
a method to list keys in the collection

Argument Type Required Default Description
self object Yes None
prefix str "" string with prefix value to filter results
delimiter str "" string with value which results must not contain (after prefix)
filter_functionfunction None (positional arguments) function used to filter results
max_results int 1 integer with maximum number of results to return
reverse_search bool True boolean to search keys in reverse alphanumeric order
previous_key str "" string with key in collection to begin search after

delete

Signature:
delete(self, record_key)

Description:
a method to delete a file

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with name of file

remove

Signature:
remove(self)

Description:
a method to remove collection and all records in the collection

export

Signature:
export(self, storage_client, overwrite=True)

Description:
a method to export all the records in collection to another platform

Argument Type Required Default Description
self objectYes None
storage_clienttype Yes None class object with storage client methods
overwrite bool True

_s3Client

Import:

labpack.storage.aws.s3._s3Client

Description:

a class of methods for interacting with AWS Simple Storage Service

__init__

Signature:
__init__(self, access_id, secret_key, region_name, owner_id, user_name, verbose=True)

Description:
a method for initializing the connection to S3

Argument Type Required Default Description
self objectYes None
access_id str Yes "" string with access_key_id from aws IAM user setup
secret_key str Yes "" string with secret_access_key from aws IAM user setup
region_namestr Yes "" string with name of aws region
owner_id str Yes "" string with aws account id
user_name str Yes "" string with name of user access keys are assigned to
verbose bool True boolean to enable process messages

list_buckets

Signature:
list_buckets(self)

Description:
a method to retrieve a list of buckets on s3

create_bucket

Signature:
create_bucket(self, bucket_name, access_control=”private”, version_control=False, log_destination=None, lifecycle_rules=None, tag_list=None, notification_settings=None, region_replication=None, access_policy=None)

Description:
a method for creating a bucket on AWS S3

Argument Type Required Default Description
self objectYes None
bucket_name str Yes "" string with name of bucket
access_control str "private"string with type of access control policy
version_control bool False [optional] boolean to enable versioning of records
log_destination dict None [optional] dictionary with bucket name and prefix of log bucket
lifecycle_rules list None [optional] list of dictionaries with rules for aging data
tag_list list None [optional] list of dictionaries with key and value for tag
notification_settingslist None [optional] list of dictionaries with notification details
region_replication dict None [optional] dictionary with replication settings (WIP)
access_policy dict None [optional] dictionary with policy for user access (WIP)

read_bucket

Signature:
read_bucket(self, bucket_name)

Description:
a method to retrieve properties of a bucket in s3

Argument Type Required Default Description
self objectYes None
bucket_namestr Yes "" string with name of bucket

update_bucket

Signature:
update_bucket(self, bucket_name, access_control=”private”, version_control=False, log_destination=None, lifecycle_rules=None, tag_list=None, notification_settings=None, region_replication=None, access_policy=None)

Description:
a method for updating the properties of a bucket in S3

Argument Type Required Default Description
self objectYes None
bucket_name str Yes "" string with name of bucket
access_control str "private"string with type of access control policy
version_control bool False [optional] boolean to enable versioning of records
log_destination dict None [optional] dictionary with bucket name and prefix of log bucket
lifecycle_rules list None [optional] list of dictionaries with rules for aging data
tag_list list None [optional] list of dictionaries with key and value for tag
notification_settingslist None [optional] list of dictionaries with notification details
region_replication dict None [optional] dictionary with replication settings (WIP)
access_policy dict None [optional] dictionary with policy for user access (WIP)

delete_bucket

Signature:
delete_bucket(self, bucket_name)

Description:
a method to delete a bucket in s3 and all its contents

Argument Type Required Default Description
self objectYes None
bucket_namestr Yes "" string with name of bucket

list_records

Signature:
list_records(self, bucket_name, prefix=”“, delimiter=”“, max_results=1000, starting_key=”“)

Description:
a method for retrieving a list of the versions of records in a bucket

Argument Type Required Default Description
self objectYes None
bucket_name str Yes "" string with name of bucket
prefix str "" [optional] string with value limiting results to key prefix
delimiter str "" string with value which results must not contain (after prefix)
max_results int 1000 [optional] integer with max results to return
starting_keystr "" [optional] string with key value to continue search with

list_versions

Signature:
list_versions(self, bucket_name, prefix=”“, delimiter=”“, max_results=1000, starting_key=”“, starting_version=”“)

Description:
a method for retrieving a list of the versions of records in a bucket

Argument Type Required Default Description
self objectYes None
bucket_name str Yes "" string with name of bucket
prefix str "" [optional] string with value limiting results to key prefix
delimiter str "" [optional] string with value limiting results to key delimiter
max_results int 1000 [optional] integer with max results to return
starting_key str "" [optional] string with key value to continue search with
starting_versionstr "" [optional] string with version id to continue search with

create_record

Signature:
create_record(self, bucket_name, record_key, record_data, record_metadata=None, record_mimetype=”“, record_encoding=”“, overwrite=True)

Description:
a method for adding a record to an S3 bucket

Argument Type Required Default Description
self object Yes None
bucket_name str Yes "" string with name of bucket
record_key str Yes "" string with name of key (path) for record
record_data NoneTypeYes None byte data for record
record_metadatadict None [optional] dictionary with metadata to attach to record
record_mimetypestr "" [optional] string with content mimetype of record data
record_encodingstr "" [optional] string with content encoding of record data
overwrite bool True [optional] boolean to overwrite any existing record

read_headers

Signature:
read_headers(self, bucket_name, record_key, record_version=”“, version_check=False)

Description:
a method for retrieving the headers of a record from s3

Argument Type Required Default Description
self objectYes None
bucket_name str Yes "" string with name of bucket
record_key str Yes "" string with key value of record
record_versionstr "" [optional] string with aws id of version of record
version_check bool False [optional] boolean to enable current version check

read_record

Signature:
read_record(self, bucket_name, record_key, record_version=”“, version_check=False)

Description:
a method for retrieving data of record from AWS S3

Argument Type Required Default Description
self objectYes None
bucket_name str Yes "" string with name of bucket
record_key str Yes "" string with name of key (path) for record
record_versionstr "" [optional] string with aws id of version of record
version_check bool False [optional] boolean to enable current version check

delete_record

Signature:
delete_record(self, bucket_name, record_key, record_version=”“)

Description:
a method for deleting an object record in s3

Argument Type Required Default Description
self objectYes None
bucket_name str Yes "" string with name of bucket
record_key str Yes "" string with key value of record
record_versionstr "" [optional] string with aws id of version of record

export_records

Signature:
export_records(self, bucket_name, export_path=”“, overwrite=True)

Description:
a method to export all the records from a bucket to local files

Argument Type Required Default Description
self objectYes None
bucket_namestr Yes "" string with name of bucket
export_pathstr "" [optional] string with path to root directory for record dump
overwrite bool True [optional] boolean to overwrite existing files matching records

import_records

Signature:
import_records(self, bucket_name, import_path=”“, overwrite=True)

Description:
a method to importing records from local files to a bucket

Argument Type Required Default Description
self objectYes None
bucket_namestr Yes "" string with name of bucket
import_pathstr ""
overwrite bool True [optional] boolean to overwrite existing files matching records

s3Client

Import:

labpack.storage.aws.s3.s3Client

Description:

a class of methods to manage file storage on AWS S3

__init__

Signature:
__init__(self, access_id, secret_key, region_name, owner_id, user_name, collection_name=”“, prod_name=”“, org_name=”“, access_control=”private”, version_control=False, log_destination=None, lifecycle_rules=None, tag_list=None, notification_settings=None, region_replication=None, access_policy=None, verbose=True)

Description:

Argument Type Required Default Description
self object Yes None
access_id NoneTypeYes None
secret_key NoneTypeYes None
region_name NoneTypeYes None
owner_id NoneTypeYes None
user_name NoneTypeYes None
collection_name str ""
prod_name str ""
org_name str ""
access_control str "private"
version_control bool False
log_destination NoneType None
lifecycle_rules NoneType None
tag_list NoneType None
notification_settingsNoneType None
region_replication NoneType None
access_policy NoneType None
verbose bool True

exists

Signature:
exists(self, record_key)

Description:
a method to determine if a record exists in collection

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with key of record

save

Signature:
save(self, record_key, record_data, overwrite=True, secret_key=”“)

Description:
a method to create a file in the collection folder on S3

Argument Type Required Default Description
self object Yes None
record_key str Yes "" string with name to assign to record (see NOTES below)
record_dataNoneTypeYes None byte data for record body
overwrite bool True [optional] boolean to overwrite records with same name
secret_key str "" [optional] string with key to encrypt data

load

Signature:
load(self, record_key, secret_key=”“)

Description:
a method to retrieve byte data of an S3 record

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with name of record
secret_keystr "" [optional] string used to decrypt data

conditional_filter

Signature:
conditional_filter(self, path_filters)

Description:
a method to construct a conditional filter function for class list method

Argument Type Required Default Description
self objectYes None
path_filtersdict Yes None dictionary or list of dictionaries with query criteria

list

Signature:
list(self, prefix=”“, delimiter=”“, filter_function=None, max_results=1, previous_key=”“)

Description:
a method to list keys in the collection

Argument Type Required Default Description
self object Yes None
prefix str "" string with prefix value to filter results
delimiter str "" string with value results must not contain (after prefix)
filter_functionfunction None (positional arguments) function used to filter results
max_results int 1 integer with maximum number of results to return
previous_key str "" string with key in collection to begin search after

delete

Signature:
delete(self, record_key)

Description:
a method to delete a record from S3

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with key of record

remove

Signature:
remove(self)

Description:
a method to remove collection and all records in the collection

export

Signature:
export(self, storage_client, overwrite=True)

Description:
a method to export all the records in collection to another platform

Argument Type Required Default Description
self objectYes None
storage_clienttype Yes None class object with storage client methods
overwrite bool True

dropboxClient

Import:

labpack.storage.dropbox.dropboxClient

Description:

a class of methods to manage file storage on Dropbox API

__init__

Signature:
__init__(self, access_token, collection_name=”“)

Description:
a method to initialize the dropboxClient class

Argument Type Required Default Description
self objectYes None
access_token str Yes "" string with oauth2 access token for users account
collection_namestr ""

exists

Signature:
exists(self, record_key)

Description:
a method to determine if a record exists in collection

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with key of record

save

Signature:
save(self, record_key, record_data, overwrite=True, secret_key=”“)

Description:
a method to create a record in the collection folder

Argument Type Required Default Description
self object Yes None
record_key str Yes "" string with name to assign to record (see NOTES below)
record_dataNoneTypeYes None byte data for record body
overwrite bool True [optional] boolean to overwrite records with same name
secret_key str "" [optional] string with key to encrypt data

load

Signature:
load(self, record_key, secret_key=”“)

Description:
a method to retrieve byte data of appdata record

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with name of record
secret_keystr "" [optional] string used to decrypt data

conditional_filter

Signature:
conditional_filter(self, path_filters)

Description:
a method to construct a conditional filter function for list method

Argument Type Required Default Description
self objectYes None
path_filtersdict Yes None dictionary or list of dictionaries with query criteria

list

Signature:
list(self, prefix=”“, delimiter=”“, filter_function=None, max_results=1, previous_key=”“)

Description:
a method to list keys in the dropbox collection

Argument Type Required Default Description
self object Yes None
prefix str "" string with prefix value to filter results
delimiter str "" string with value which results must not contain (after prefix)
filter_functionfunction None (positional arguments) function used to filter results
max_results int 1 integer with maximum number of results to return
previous_key str "" string with key in collection to begin search after

delete

Signature:
delete(self, record_key)

Description:
a method to delete a file

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with name of file

remove

Signature:
remove(self)

Description:
a method to remove all records in the collection

    NOTE:   this method removes all the files in the collection, but the
            collection folder itself created by oauth2 cannot be removed.
            only the user can remove the app folder

export

Signature:
export(self, storage_client, overwrite=True)

Description:
a method to export all the records in collection to another platform

Argument Type Required Default Description
self objectYes None
storage_clienttype Yes None class object with storage client methods
overwrite bool True

driveClient

Import:

labpack.storage.google.drive.driveClient

Description:

a class of methods to manage file storage on Google Drive API

__init__

Signature:
__init__(self, access_token, collection_name=”“)

Description:
a method to initialize the driveClient class

Argument Type Required Default Description
self objectYes None
access_token str Yes "" string with oauth2 access token for users account
collection_namestr "" [optional] string with name of collection for import

exists

Signature:
exists(self, record_key)

Description:
a method to determine if a record exists in collection

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with key of record

save

Signature:
save(self, record_key, record_data, overwrite=True, secret_key=”“)

Description:
a method to create a record in the collection folder

Argument Type Required Default Description
self object Yes None
record_key str Yes "" string with name to assign to record (see NOTES below)
record_dataNoneTypeYes None byte data for record body
overwrite bool True [optional] boolean to overwrite records with same name
secret_key str "" [optional] string with key to encrypt data

load

Signature:
load(self, record_key, secret_key=”“)

Description:
a method to retrieve byte data of appdata record

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with name of record
secret_keystr "" [optional] string used to decrypt data

conditional_filter

Signature:
conditional_filter(self, path_filters)

Description:
a method to construct a conditional filter function for list method

Argument Type Required Default Description
self objectYes None
path_filtersdict Yes None dictionary or list of dictionaries with query criteria

list

Signature:
list(self, prefix=”“, delimiter=”“, filter_function=None, max_results=1, previous_key=”“)

Description:
a method to list keys in the google drive collection

Argument Type Required Default Description
self object Yes None
prefix str "" string with prefix value to filter results
delimiter str "" string with value which results must not contain (after prefix)
filter_functionfunction None (positional arguments) function used to filter results
max_results int 1 integer with maximum number of results to return
previous_key str "" string with key in collection to begin search after

delete

Signature:
delete(self, record_key)

Description:
a method to delete a file

Argument Type Required Default Description
self objectYes None
record_keystr Yes "" string with name of file

remove

Signature:
remove(self)

Description:
a method to remove all records in the collection

    NOTE:   this method removes all the files in the collection, but the
            collection folder itself created by oauth2 cannot be removed.
            only the user can remove access to the app folder

export

Signature:
export(self, storage_client, overwrite=True)

Description:
a method to export all the records in collection to another platform

Argument Type Required Default Description
self objectYes None
storage_clienttype Yes None class object with storage client methods
overwrite bool True