Metadata-Version: 2.4
Name: prefect-xquik
Version: 0.1.10
Summary: Prefect tasks for scheduled Twitter search, profiles, timelines, trends, and X API workflows. Not affiliated with X Corp.
Project-URL: Documentation, https://docs.xquik.com/guides/prefect
Project-URL: Homepage, https://docs.xquik.com/guides/prefect
Project-URL: Changelog, https://github.com/Xquik-dev/prefect-xquik/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/Xquik-dev/prefect-xquik/issues
Project-URL: Source, https://github.com/Xquik-dev/prefect-xquik
Project-URL: Xquik API Reference, https://docs.xquik.com/api-reference/overview
Author: Xquik
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: data-pipelines,prefect,prefect-collection,prefect-integration,social-media-api,tweet-search,twitter-api,twitter-search,workflow-orchestration,x-api,xquik
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.28.1
Requires-Dist: prefect>=3.8.3
Requires-Dist: pydantic>=2.13.4
Description-Content-Type: text/markdown

# Prefect tasks for Twitter search & X API workflows

[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/13728/badge)](https://www.bestpractices.dev/projects/13728)

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](https://docs.xquik.com/api-reference/overview) for follower exports or publishing.

## Install

```bash
pip install prefect-xquik
```

## Store X API credentials

```bash
prefect block register -m prefect_xquik
```

Create a Prefect block in the UI or with Python:

```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

```python
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

```python
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`:

```python
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

- [Xquik Prefect guide](https://docs.xquik.com/guides/prefect)
- [Xquik API reference](https://docs.xquik.com/api-reference/overview)
- [Prefect workflows and tasks](https://docs.prefect.io/v3/how-to-guides/workflows/write-and-run)
- [Organization support policy](https://github.com/Xquik-dev/.github/blob/main/SUPPORT.md)
- [Security policy](SECURITY.md)
- [Contributing](CONTRIBUTING.md)

## Develop locally

```bash
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.
