Skip to main content

Pypeform: Python Package for Typeform Response Piping

Pypeform is a Python package designed to make inbound Typeform responses easier to work with. Provide data as a Flask request or JSON-based dictionary, and access the response in a Pythonic/OOP manner.

Note: not all field types have been implemented, but most basic fields are supported. Feel free to contribute with a PR.

Installation

Install Pypeform from PyPi:

pip install pypeform

Usage

There's a few handy ways to use Pypeform, depending on how you're receiving the webhook data. Most of the time, you'll be dealing with an Event object -- a form submission. However, you can also use the FormResponse object directly it's JSON constructors if you don't need the event_id etc.

Flask requests

This option is useful if you're handling Typeform data in a Flask web application. This is often the case when you're using a Google Cloud Function, for example.

With a full requests object, you also have the option to verify the response is legitimate, using a pre-shared secret provided in the Typeform webhook dialog.

from pypeform import Event

request = ... # Flask request object
my_event = Event.from_request(request=request)
form_response = my_event.form_response

for answer in form_response.answers:
    print(answer)

for field in form_response.fields:
    print(field)

for variable in form_response.variables:
    print(variable)

JSON Data

If you have the JSON data of the response in hand, you can still construct an Event object:

import json
from pypeform import Event

my_json_data = json.loads(...)

# event_json must be a dict, as provided by the Typeform webhook
Event.from_event_json(event_json=my_json_data)

In future versions, we'll add the ability to verify the response using the pre-shared secret (although you'll have to extract the typeform-signature header from the webhook headers yourself).

Release files for pypeform-package 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypeform-package 0.0.4
File Size Uploaded
pypeform_package-0.0.4.tar.gz 19.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pypeform-package 0.0.4
File Interpreter ABI Platform
pypeform_package-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 27.7 kB

Release files / pypeform_package-0.0.4.tar.gz

Download URL pypeform_package-0.0.4.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d6d74b1f3803cf216a4484a8617cf8cfdde2252bb89fd78c8a6aaae6d76a1535
BLAKE2b-256 checksum
How to use checksums
688c60b8ad2f5ac396f2df4821a41e2d25f665a4c43c7fd79228906f9e46263c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.9

Release files / pypeform_package-0.0.4-py3-none-any.whl

Download URL pypeform_package-0.0.4-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34def00d7151c9dfc86aaaffe0b3dfd5340ee82a241e52ceb3b618a7c68f727b
BLAKE2b-256 checksum
How to use checksums
ebdd020fd4212e036868cfd2946cf9f8051b9854d9117e555cacd3f6e10fc127
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.8.9

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page