Skip to content

konstunn/pyrusapi-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyrus-api

PyPI version

A Python 3 client for the Pyrus API. The full documentation for API can be found here

Getting Started

  • instal pyrus-api library:

  • Import packages into your project:

from pyrus import client
import pyrus.models
  • Create API client:
pyrus_client = client.PyrusAPI(login='login@pyrus.com', security_key='sadf2R5Wrdkn..')
  • Perform authorization:
auth_response = pyrus_client.auth()
if response.success:
    pass

Forms

  • Get all form templates:
forms_response = pyrus_client.get_forms()
forms = forms_response.forms
  • Get tasks list by form template:
request = pyrus.models.requests.FormRegisterRequest(
        include_archive=True,
        steps=[1,2],
        filters=[pyrus.models.entities.EqualsFilter(1, "hello world")])
form_register_response = pyrus_client.get_registry(forms[0].id, request)
tasks = form_register_response.tasks

Tasks

  • Get task with all comments:
task = pyrus_client.get_task(tasks[0].id).task
  • Add task comment:
request = pyrus.models.requests.TaskCommentRequest(text="hello", action="finished")
task = pyrus_client.comment_task(tasks[0].id, request).task
  • Create a task:
request = CreateTaskRequest(
        text="Task from python client", 
        participants=['colleague@email.com', 10196]
        attachments = ['BEFCE22E-AEFF-4771-83D4-2A4B78FB05C6'])
task = pyrus_client.create_task(request).task

Files

  • Upload a file:
response = pyrus_client.upload_file('C:\\path\\to\\file.txt').guid

Catalogs

  • Get catalog with all items:
catalog_id = 1525
catalog_response = pyrus_client.get_catalog(catalog_id)
items = catalog_response.items
  • Create catalog
request = pyrus.models.requests.CreateCatalogRequest(
        name = "NewCatalog",
        catalog_headers = ["Column1", "Column2", "Column3"],
        items = [
            ["A1", "A2", "A3"],
            ["B1", "B2", "B3"],
            ["C1", "C2", "C3"]
        ]
    )
catalog_id = pyrus_client.create_catalog(request).catalog_id
  • Sync catalog (All unspecified catalog items and text columns will be deleted)
catalog_id = 7825
request = pyrus.models.requests.SyncCatalogRequest(
        apply = True,
        catalog_headers = ["Column1", "Column4", "Column3"],
        items = [
            ["A1", "A2", "A3"],
            ["B1", "B4", "B5"],
            ["D1", "D2", "D3"]
        ]
    )
response = pyrus_client.sync_catalog(catalog_id, request)
delted = response.deleted
updated = response.updated
added = response.added
new_headers = response.catalog_headers

Contacts

  • Get all available contacts:
contacts = pyrus_client.get_contacts()

Lists

  • Get all lists
response = pyrus_client.get_lists()
lists = response.lists
  • Get all tasks in list
list_id = 1522
response = pyrus_client.get_task_list(list_id, item_count=25, include_archived=True)
tasks = response.tasks

Support

If you have any questions or comments please send an email to support@pyrus.com

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%