Hubstaff API python client
Connect using email & password:
import os
from hubstaff.client_v1 import HubstaffClient
hubstaff = HubstaffClient(
app_token=os.getenv('HUBSTAFF_APP_TOKEN'),
username=os.getenv('HUBSTAFF_USERNAME'),
password=os.getenv('HUBSTAFF_PASSWORD'))
os.environ['HUBSTAFF_AUTH_TOKEN'] = hubstaff.authenticate()
Connect using received before authentication token:
import os
from hubstaff.client_v1 import HubstaffClient
hubstaff = HubstaffClient(
app_token=os.getenv('HUBSTAFF_APP_TOKEN'),
auth_token=os.getenv('HUBSTAFF_AUTH_TOKEN'))
hubstaff.authenticate()
Take users list:
users_list = hubstaff.get_users_list(
include_projects=True,
include_organizations=True)
Take user item:
user_item = hubstaff.get_user_item(user_id=123)
user_item['projects'] = hubstaff.get_user_projects_list(user_id=123)
user_item['organizations'] = hubstaff.get_user_organizations_list(user_id=123)
Take projects list:
projects_list = hubstaff.get_projects_list(status='active')
Take project item:
project_item = hubstaff.get_project_item(project_id=123)
Take tasks list:
tasks_list = hubstaff.get_tasks_list(project_id_list=[123, 456])
Take task item:
task_item = hubstaff.get_task_item(task_id=123)
Take activities list:
activities_list = hubstaff.get_activities_list(
datetime(year=2019, month=7, day=29),
datetime(year=2019, month=7, day=30),
user_id_list=[123, 456],
organization_id_list=[123, 456],
project_id_list=[123, 456])