Skip to content

wisr/typeform-python-sdk

 
 

Repository files navigation

typeform

PyPI version Build Status Coverage Status

Python Client wrapper for Typeform API

Table of contents

Installation

pip install typeform

Usage

Initialize

1 - Import client library

  from typeform import Typeform

2 - Create an instance with your personal token

  typeform = Typeform('<api_key>')

3 - Use any of the methods available in the reference

  # will retrieve all forms
  forms: dict = typeform.forms.list()

Reference

Typeform('<api_key>')

  • Creates a new instance of Typeform's Python client
  • Returns an instance with the methods described below
  typeform = Typeform('<api_key>')

Client returns the following properties:

  • forms

Each one of them encapsulates the operations related to it (like listing, updating, deleting the resource).

Forms

forms.create(data={})

Creates a form. Returns dict of created form. See docs.

forms = Typeform('<api_key>').forms
forms.create({ 'title': 'Hello World' })

forms.delete('Form ID')

Deletes the form with the given form_id and all of the form's responses. Return a str based on success of deletion, OK on success, otherwise an error message. See docs.

forms = Typeform('<api_key>').forms
forms.delete('abc123') # OK

forms.get('Form ID')

Retrieves a form by the given form_id. Includes any theme and images attached to the form as references. See docs.

forms = Typeform('<api_key>').forms
forms.get('abc123')

forms.list()

Retrieves a list of JSON descriptions for all forms in your Typeform account (public and private). Forms are listed in reverse-chronological order based on the last date they were modified. See docs.

forms = Typeform('<api_key>').forms
forms.list()

forms.update('Form ID', data={}, patch=False)

Updates an existing form. Defaults to put. put will return the modified form as a dict object. patch will return a str based on success of change, OK on success, otherwise an error message. See put docs or patch docs.

forms.messages.get('Form ID')

Retrieves the customizable messages for a form (specified by form_id) using the form's specified language. You can format messages with bold (bold) and italic (italic) text. HTML tags are forbidden. See docs.

forms = Typeform('<api_key>').forms
forms.messages.get('abc123')

forms.messages.update('Form ID', data={})

Specifies new values for the customizable messages in a form (specified by form_id). You can format messages with bold (bold) and italic (italic) text. HTML tags are forbidden. Return a str based on success of change, OK on success, otherwise an error message. See docs.

forms = Typeform('<api_key>').forms
forms.messages.update('abc123', {
    'label.buttonHint.default': 'New Button Hint'
})

About

TypeForm Python API client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%