Skip to main content

Prefect tasks for Twitter search & X API workflows

OpenSSF Best Practices

Schedule 6 read-only Twitter search, profile, timeline, and trend tasks in Prefect 3. Store X API keys in Prefect blocks.

Tasks

Workflow step Prefect task Xquik endpoint
Search tweets search_tweets GET /x/tweets/search
Read one tweet get_tweet GET /x/tweets/{id}
Search X profiles search_users GET /x/users/search
Read one profile get_user GET /x/users/{id}
Read a profile timeline get_user_tweets GET /x/users/{id}/tweets
Read regional trends get_trends GET /x/trends

Use the REST API for follower exports or publishing.

Install

pip install prefect-xquik

Store X API credentials

prefect block register -m prefect_xquik

Create a Prefect block in the UI or with Python:

from prefect_xquik import XquikCredentials

credentials = XquikCredentials(api_key="your_xquik_api_key_here")
credentials.save("xquik", overwrite=True)

Keep API keys in Prefect blocks. Never put them in flow source files.

Create a flow

from prefect import flow
from prefect_xquik import XquikCredentials, get_trends, search_tweets


@flow
async def twitter_signal_flow() -> dict:
    credentials = XquikCredentials.load("xquik")

    tweets = await search_tweets(
        credentials,
        query='"prefect" OR "workflow orchestration"',
        query_type="Latest",
        limit=25,
    )
    trends = await get_trends(credentials, woeid=1, count=10)

    return {"tweets": tweets, "trends": trends}

Import tasks

from prefect_xquik import (
    get_trends,
    get_tweet,
    get_user,
    get_user_tweets,
    search_tweets,
    search_users,
)

Tasks return raw Xquik JSON dictionaries and support Prefect's with_options:

from prefect_xquik import search_tweets

search_recent_tweets = search_tweets.with_options(
    name="Search recent tweets",
    retries=2,
    retry_delay_seconds=10,
)

API contract

The credentials block sends x-api-key and xquik-api-contract: 2026-04-29 headers.

Documentation

Develop locally

uv sync
uv run ruff format --check .
uv run ruff check .
uv run pip-audit
uv run pytest
./scripts/build_reproducibly.sh
uv run twine check dist/*

Pytest enforces 100% coverage. CI checks REUSE 3.3 metadata, dependencies, and byte-for-byte builds.

Xquik is an independent third-party service. Not affiliated with X Corp. "Twitter" and "X" are trademarks of X Corp.

Release files for prefect-xquik 0.1.10

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

Source distribution (sdist)

Source distribution for prefect-xquik 0.1.10
File Size Uploaded
prefect_xquik-0.1.10.tar.gz 230.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prefect-xquik 0.1.10
File Interpreter ABI Platform
prefect_xquik-0.1.10-py3-none-any.whl Python 3 none any Details

Total release size: 242.0 kB

Release files / prefect_xquik-0.1.10.tar.gz

Download URL prefect_xquik-0.1.10.tar.gz
Size 230.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8de3531c4ef47efc22e18b3ef7974c4198608021478896f130bec135205d1b98
BLAKE2b-256 checksum
How to use checksums
07bf4f710646cfee920af6b1a58bf706b47d0590e225f6bb252b2d42914f9b93
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release files / prefect_xquik-0.1.10-py3-none-any.whl

Download URL prefect_xquik-0.1.10-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87300077a16fdf21f88276bd2fb0299f85cbdbf7957485bd410db48d165e2f9e
BLAKE2b-256 checksum
How to use checksums
8c3471d01f1e88fba168fff064e6adfb150148d491da6461a0ceb5607000ea0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.10 This release

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

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