Skip to main content

Python Pyrus API client

Project description

A python 3 client for the Pyrus API.

Support custom URL for API and http proxy-server

The full documentation for API can be found here.

Installation

To get the latest version:

Usage

To start with the module:

>>>  from pyrus import client
>>>  import pyrus.models
>>>  pyrus_client = client.PyrusAPI(login='login@example.com', security_key='sadf2R5Wrdkn..',proxy='http://proxy:3128',api_addr='api.pyrus.com')

Examples

Authenticate:

>>> pyrus_client.auth()

Get all form templates:

>>> forms_response = pyrus_client.get_forms()
>>> forms = forms_response.forms

Get list of tasks created using specified form:

>>> form_register_response = pyrus_client.get_registry(forms[0].id)
>>> tasks = form_register_response.tasks

You can also filter registry by specific field value, status or current step number:

>>> 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)

Get task with all comments:

>>> task = pyrus_client.get_task(tasks[0].id).task

Add new comment to the task:

>>> request = pyrus.models.requests.TaskCommentRequest(text="hello", action="finished")
>>> task = pyrus_client.comment_task(tasks[0].id, request).task
Upload a file:
>>> response = myclient.upload_file('C:\\path\\to\\file.txt').guid

Create a task:

>>> request = CreateTaskRequest(
        text="Task from python client",
        participants=['colleague@email.com', 10196] #you can specify person id, email, or pyrus.models.entities.Person object
        attachments = [guid])
>>> task = pyrus_client.create_task(request).task

Get all available contacts:

>>> contacts = pyrus_client.get_contacts()

Get catalog with all items:

>>> catalog_id = 1525
>>> catalog_response = pyrus_client.get_catalog(catalog_id)
>>> items = catalog_response.items

Get profile:

>>> profile_response = pyrus_client.get_profile()

Get inbox:

>>> inbox_response = pyrus_client.get_inbox(tasks_count=100)

Get calendar:

>>> calendar_response = (pyrus_client.get_calendar_tasks(req.CalendarRequest(
            datetime.datetime.utcnow() - datetime.timedelta(days=30),
            datetime.datetime.utcnow() + datetime.timedelta(days=30),
            all_accessed_tasks=True,
            item_count=55,
            filter_mask=0b0111)))

Get announcement with all comments:

>>> announcement = pyrus_client.get_announcement(12321321).announcement

Get announcements with all comments:

>>> announcements = pyrus_client.get_announcements().announcements

Add new comment to the announcement:

>>> request = pyrus.models.requests.AnnouncementCommentRequest(text="hello", attachments = ['BEFCE22E-AEFF-4771-83D4-2A4B78FB05C6'])
>>> announcement = pyrus_client.comment_announcement(12321321, request).announcement

Create an announcement:

>>> request = CreateAnnouncementRequest(
        text="Announcement from python client",
        attachments = [guid])
>>> announcement = pyrus_client.create_announcement(request).announcement

Get form permissions:

>>> permissions = pyrus_client.get_permissions(123)

Change form permissions:

>>> request = pyrus.models.requests.ChangePermissionsRequest({1733:'member'})
>>> changed_permissions = pyrus_client.change_permissions(123, request)

Support

If you have any questions or comments please send an email to tailgrabik@gmail.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyrus_api_mod-2.19.5.tar.gz (24.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyrus_api_mod-2.19.5-py3-none-any.whl (25.5 kB view details)

Uploaded Python 3

File details

Details for the file pyrus_api_mod-2.19.5.tar.gz.

File metadata

  • Download URL: pyrus_api_mod-2.19.5.tar.gz
  • Upload date:
  • Size: 24.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for pyrus_api_mod-2.19.5.tar.gz
Algorithm Hash digest
SHA256 ca0b2664bca7907e7b9f3de9f9a299bd397ced36271da92ce02d291828a78d89
MD5 fba1c27e6087761f3efbb3984f285e3a
BLAKE2b-256 ea4ca2f7884c4aae737d662afa43f305869a6ea91600891cf24ead8d1c7de403

See more details on using hashes here.

File details

Details for the file pyrus_api_mod-2.19.5-py3-none-any.whl.

File metadata

  • Download URL: pyrus_api_mod-2.19.5-py3-none-any.whl
  • Upload date:
  • Size: 25.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for pyrus_api_mod-2.19.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c05111dc4c4d7386b2fe951a80569c8c957fe40e26434105a2b39d4eeb9fbbe1
MD5 5355759ae212a5ff8d01fc2e4f50c990
BLAKE2b-256 33636fde1c8decb6b33f07cf462d01692ce5795ab10aef3a0a53c2282029528e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page