/glassflow-python-sdk

GlassFlow Python SDK to publish and consume data to your pipelines at Glassflow.dev

Primary LanguagePythonMIT LicenseMIT



License: MIT Chat on Slack Ruff

GlassFlow Python SDK

The GlassFlow Python SDK provides a convenient way to interact with the GlassFlow API in your Python applications. The SDK is used to publish and consume events to your GlassFlow pipelines.

Installation

You can install the GlassFlow Python SDK using pip:

pip install glassflow

Available Operations

  • publish - Publish a new event into the pipeline
  • consume - Consume the transformed event from the pipeline
  • consume failed - Consume the events that failed from the pipeline

publish

Publish a new event into the pipeline

Example Usage

import glassflow

client = glassflow.GlassFlowClient()
pipeline_client = client.pipeline_client(pipeline_id="<str value", pipeline_access_token="<str value>")
data = {} # your json event
res = pipeline_client.publish(request_body=data)

if res.status_code == 200:
    print("Published sucessfully")

consume

Consume the transformed event from the pipeline

Example Usage

import glassflow

client = glassflow.GlassFlowClient()
pipeline_client = client.pipeline_client(pipeline_id="<str value", pipeline_access_token="<str value>")
res = pipeline_client.consume()

if res.status_code == 200:
    print(res.body.event)

consume failed

If the transformation failed for any event, they are available in a failed queue. You can consume those events from the pipeline

Example Usage

import glassflow

client = glassflow.GlassFlowClient()
pipeline_client = client.pipeline_client(pipeline_id="<str value", pipeline_access_token="<str value>")
res = pipeline_client.consume_failed()

if res.status_code == 200:
    print(res.body.event)

Quickstart

Follow the quickstart guide here

Code Samples

GlassFlow Examples

SDK Maturity

Please note that the GlassFlow Python SDK is currently in beta and is subject to potential breaking changes. We recommend keeping an eye on the official documentation and updating your code accordingly to ensure compatibility with future versions of the SDK.

User Guides

For more detailed information on how to use the GlassFlow Python SDK, please refer to the GlassFlow Documentation. The documentation provides comprehensive guides, tutorials, and examples to help you get started with GlassFlow and make the most out of the SDK.

Contributing

Anyone who wishes to contribute to this project, whether documentation, features, bug fixes, code cleanup, testing, or code reviews, is very much encouraged to do so.

  1. Join the Slack channel.

  2. Just raise your hand on the GitHub discussion board.

If you are unfamiliar with how to contribute to GitHub projects, here is a Get Started Guide. A full set of contribution guidelines, along with templates, are in progress.

Troubleshooting

For any questions, comments, or additional help, please reach out to us via email at help@glassflow.dev. Please check out our Q&A to get solutions for common installation problems and other issues.

Raise an issue

To provide feedback or report a bug, please raise an issue on our issue tracker.