Skip to main content

A client library to communicate with the WebFlow API

Project description

Welcome to fast-webflow

a WebFlow CMS API Client in Python

License PyPI version PyPI stats

This Python library provides an intuitive and fast interface over WebFlow's API. It simplifies the process of integrating your Python applications with the WebFlow content management system (CMS), allowing you to create, read, update, and delete items within your WebFlow collections.

Check out an example website built with the help of fast-webflow: liguriasegreta.com

DISCLAIMER : This is an unofficial abstraction over WebFlow's API and I am not associated with the WebFlow team.

Roadmap

  • Add e-commerce functionality
  • Add membership functionality
  • Add tests
  • Finish documentation
  • Publish to PyPi

Features

  • Authenticate with the WebFlow API using your API key
  • Fetch, Create, Update, and Delete Items and files from WebFlow Collections
  • Handle pagination for large Collections
  • Hidden parallelization for faster operations (with implicit error handling)

Installation

You can install the package using pip:

pip install fast-webflow

Getting Started

  1. Obtain an API key from WebFlow by following their API Access Token.
  2. Import the cms module from the fast-webflow package automatically to interact with the WebFlow CMS API; then authenticate:
import webflow.cms as cms
api_key = 'YOUR_API_KEY'
cms.authenticate(api_key)
  1. Start interacting with the WebFlow API using the provided methods. For example, to fetch all items from a collection:
from webflow.cms import Collection

collection_id = 'COLLECTION_ID'
collection = Collection(collection_id)
items = collection.get_all_items()

for item in items:
    print(item["slug"])

Examples

If you are quickly searching for a particular code snippet, I hope you can find it here. These all assume that you are already authenticated (if not, see the quickstart).

Create CMS Elements

Elements from the CMS are handled via classes, with relevant methods for each. Classes also behave like dictionaries, holding by default some basic information (fetched from the CMS at creation time).

from webflow.cms import Site, Collection, Item

# connect to the Sites part of the API
site_id = 'YOUR_SITE_ID'
site = Site(site_id)

# connect to the Collections part of the API
collection_id = 'YOUR_COLLECTION_ID'
collection = Collection(collection_id)

# connect to the Items part of the API
item_id = 'YOUR_ITEM_ID'
item = Item(item_id)

Fetch Data

from webflow.cms import Site, Collection, Item

# get list of available sites
sites = cms.list_sites()
site_id = sites[0]['_id']

# connect to that site's CMS and get some data
site = Site(site_id)
assert site_id == site.id == site['_id']

collections   = site.get_collections()
domains       = site.get_domains()
site_details  = site.get_data()
site_name     = site['name']
# connect to a collection in the CMS and get some data
collection_id = 'YOUR_CONNECTION_ID'
collection = Collection(collection_id)
items = collection.get_all_items()
# connect to an item in the CMS and get some data
item_id = 'YOUR_ITEM_ID'
item = Item(item_id)
item_data = item.get_data()

Publish Website

from webflow.cms import Site

# connect to that site's CMS and publish it
site_id = 'YOUR_SITE_ID'
site = Site(site_id)
site.publish()

# you may specify custom domains too
site.publish(['www.first.domain.com', 'www.second.domain.com'])

Upload Data

from webflow.cms import Site, Collection, Item

new_items = [
  {
    'name': 'first item,
    'slug': 'item1
  },
  {
    'name': 'second item,
    'slug': 'item2
  },
]
added_items = collection.post_items(new_items)

Contributing

Contributions to the fast-WebFlow Python Client library are welcome! If you encounter any bugs, have suggestions, or would like to contribute new features, please feel free to open an issue or submit a pull request on GitHub. You can also contact me directly!

License

This project is licensed under the GNU GPLv3 License. See the LICENSE file for more information.

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

fast-webflow-0.5.1.tar.gz (21.3 kB view details)

Uploaded Source

Built Distribution

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

fast_webflow-0.5.1-py3-none-any.whl (24.7 kB view details)

Uploaded Python 3

File details

Details for the file fast-webflow-0.5.1.tar.gz.

File metadata

  • Download URL: fast-webflow-0.5.1.tar.gz
  • Upload date:
  • Size: 21.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for fast-webflow-0.5.1.tar.gz
Algorithm Hash digest
SHA256 8709b246e9c75aeddd8e6dfc4d61e9a9521894e5a71d0305be8d387a1a5cbfb4
MD5 116443dbb515a10fa73ec883b7ccd528
BLAKE2b-256 9205c8ca50aa1b85fc4ea8a1c9e1d1b6d95b6d95f2899c2dcc223646adb061d8

See more details on using hashes here.

File details

Details for the file fast_webflow-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: fast_webflow-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 24.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for fast_webflow-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 665ff741abf8372c9d454e075ce26ba41755314abd50802c16450cc6ff5c3e44
MD5 c6c73a39b434658d61a49d973baa6259
BLAKE2b-256 95251d9ecea368ca57376747ea469be9e4078764e669b6024b6db3f92361f91c

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