Skip to main content

The world's leading Reach Enablement Platform

Project description

Inkit

This is an SDK to use with Inkit. Learn more at https://inkit.com or signup right away with https://app.inkit.com.

Installing:

pip install inkit

Usage Examples:

import inkit
from inkit.exceptions import InkitClientException, InkitResponseException


inkit.api_token = 'xxxxxtokenxxxxx'


# Get list of Folders

try:
    resp = inkit.Folder.list(
        sort='created_at',
        data_description='My'
    )

except InkitResponseException as e:
    print(e)
    print(e.response.data)

except InkitClientException as e:
    print(e)

else:
    print(resp.data.items)


# Create Template (HTML example with inkit_storage destination)

resp = inkit.Template.create(
    name='My HTML template',
    source='html',
    file='<html>My awesome HTML</html>',
    data={
        'width': 6.5,
        'height': 11.5,
        'unit': 'in'
    },
    destinations=[{  # inkit_storage
        'id': 'dest_12345',
        'folder_id': 'fold_12345',
        'expire_after_n_views': 2,
        'required': True,
        'retain_for': {
            'hours': 1
        }
    }]
)
print(resp.data)


# Create Template (DOCX example with inkit_storage and salesforce destinations)

with open('path/to/your/file.docx', 'rb') as f:
    docx = f.read()

resp = inkit.Template.create(
    name='My DOCX template',
    source='docx',
    file=docx,
    data={
        'file_name': 'DOCX template'
    },
    destinations=[
        {
            'id': 'dest_12345',
            'folder_id': 'fold_12345',
            'expire_after_n_views': 2,
            'required': True
        },
        {
            'id': 'dest_123456',
            'type': 'file'
        }
    ]
)
print(resp.data)


# Get list of Templates

resp = inkit.Template.list(
    search='My',
    sort='created_at',
    page=1,
    source='docx'
)
print(resp.data.items)


# Get single Template

resp = inkit.Template.get('tmpl_12345')
print(resp.data)


# Create Render

resp = inkit.Render.create(
    template_id='tmpl_12345',
    merge_parameters={
        'mp1': 'MP1',
        'mp2': 'MP2'
    },
    destinations={
        'inkit_storage': {
            'name': 'My awesome render',
            'description': 'My awesome render description'
        },
        'salesforce': {
            'record_id': 'Your salesforce LinkedEntityId',
            'file_name': 'My awesome PDF',
            'description': 'Salesforce PDF description'
        }
    }
)
print(resp.data)


# Get single Render

resp = inkit.Render.get('rend_12345')
print(resp.data)


# Get list of Renders

resp = inkit.Render.list(
    sort='-created_at',
    page_size=2,
    page=1,
    destination_name='salesforce',
    destination_status='completed'
)
print(resp.data.items)


# Get PDF document

resp = inkit.Render.get_pdf('rend_12345')
print(len(resp.content))


# Create renders Batch

resp = inkit.Batch.create(
    template_id='tmpl_123456',
    renders=[
        {
            'merge_parameters': {
                'mp1': 'MP1',
                'mp2': 'MP2'
            },
            'destinations': {
                'inkit_storage': {
                    'name': 'My first batch render',
                    'description': 'My first batch render description'
                },
                'salesforce': {
                    'record_id': 'Your salesforce LinkedEntityId',
                    'file_name': 'My first awesome PDF',
                    'description': 'Salesforce first PDF description'
                }
            }
        },
        {
            'merge_parameters': {
                'mp1': 'MP11',
                'mp2': 'MP22'
            },
            'destinations': {
                'inkit_storage': {
                    'name': 'My second batch render'
                },
                'salesforce': {
                    'record_id': 'Your salesforce LinkedEntityId',
                    'file_name': 'My second awesome PDF',
                    'description': 'Salesforce second PDF description'
                }
            }
        }
    ]
)
print(resp.data)


# Get list of renders Batches

resp = inkit.Batch.list(
    destination_name='inkit_storage'
)
print(resp.data.items)


# Get single renders Batch

resp = inkit.Batch.get('rb_12345')
print(resp.data)


# Get list of Documents

resp = inkit.Document.list(
    search='My'
)
print(resp.data.items)


# Get single Document

resp = inkit.Document.get('doc_12345')
print(resp.data)


# Delete Document

resp = inkit.Document.delete('doc_12345')
print(resp.status_code)


# Get PDF document

resp = inkit.Document.download('doc_12345')
print(len(resp.content))

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

inkit-1.0.5.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

inkit-1.0.5-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file inkit-1.0.5.tar.gz.

File metadata

  • Download URL: inkit-1.0.5.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.10

File hashes

Hashes for inkit-1.0.5.tar.gz
Algorithm Hash digest
SHA256 38b994804da6f6aa29102c04e25b253729682b89a444c7b2995e047f4e2d5087
MD5 66045774a7a27dc2b3e4f211e9d2274e
BLAKE2b-256 0bc5b42f6559f66d7a7e3bc53c973cb45302776f021bfb4e70ec9a60abc6daa0

See more details on using hashes here.

File details

Details for the file inkit-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: inkit-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.10

File hashes

Hashes for inkit-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 6b5a7501f5aa23f3a7b1d3bbddff685171353e17d2b047aa788ae635304eeb94
MD5 b06597aaa3a429802b7a50d711f05917
BLAKE2b-256 cfc01934d1cc8a5fb10cb186d65ddd5160e2270cd2df99ffd69bfad68d5294cf

See more details on using hashes here.

Supported by

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