Skip to main content

Haystack web search components for Xquik public X data

Project description

Xquik Haystack

Haystack web search components for retrieving public X/Twitter context through the Xquik REST API.

Documentation: https://docs.xquik.com/guides/haystack

This package is maintained by Xquik as a standalone Haystack integration. It follows the haystack_integrations namespace convention and exposes read-only components under:

from haystack_integrations.components.websearch.xquik import XquikTweetSearch, XquikUserTweetsFetcher

Components

  • XquikTweetSearch: calls GET /x/tweets/search and returns matching posts as Haystack Document objects.
  • XquikUserTweetsFetcher: calls GET /x/users/{id}/tweets and returns recent public posts for a user as Haystack Document objects.

Both components:

  • read the API key from XQUIK_API_KEY by default
  • accept haystack.utils.Secret for explicit API key injection
  • send the x-api-key and xquik-api-contract: 2026-04-29 headers
  • keep base_url configurable for tests and controlled deployments
  • return documents, links, has_more, and next_cursor

Installation

Install from PyPI:

pip install xquik-haystack

Usage

Tweet Search

from haystack import Pipeline
from haystack.utils import Secret
from haystack_integrations.components.websearch.xquik import XquikTweetSearch

search = XquikTweetSearch(api_key=Secret.from_env_var("XQUIK_API_KEY"), top_k=10)

pipeline = Pipeline()
pipeline.add_component("x_search", search)

result = pipeline.run({"x_search": {"query": "haystack ai"}})
documents = result["x_search"]["documents"]

User Tweets

from haystack.utils import Secret
from haystack_integrations.components.websearch.xquik import XquikUserTweetsFetcher

fetcher = XquikUserTweetsFetcher(api_key=Secret.from_env_var("XQUIK_API_KEY"))

result = fetcher.run(user_id="xquikcom", include_replies=False)
documents = result["documents"]

Document Mapping

Each tweet becomes a Haystack Document.

  • Document.content: tweet text, or an empty string when text is missing
  • Document.meta["endpoint"]: Xquik endpoint family used by the component
  • Document.meta["id"]: tweet ID when present
  • Document.meta["url"]: tweet URL when present
  • Document.meta["created_at"]: tweet creation time when present
  • Document.meta["author"]: author ID, username, display name, and verification status when present
  • Document.meta also includes available public metrics such as like, repost, reply, quote, view, and bookmark counts

Development

This project uses Hatch for build and environment management.

pip install hatch
hatch run fmt-check
hatch run test:unit
hatch build

Unit tests mock all Xquik HTTP calls. Integration tests can be added later behind an XQUIK_API_KEY check.

Publishing

The release workflow publishes to PyPI with trusted publishing when a GitHub release is published.

After a first PyPI version is published, submit a listing PR to deepset-ai/haystack-integrations as requested by the Haystack maintainers.

License

xquik-haystack is distributed under the terms of the Apache-2.0 license.

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

xquik_haystack-0.1.0.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

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

xquik_haystack-0.1.0-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

Details for the file xquik_haystack-0.1.0.tar.gz.

File metadata

  • Download URL: xquik_haystack-0.1.0.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xquik_haystack-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ada309f4865a44e6e7edbdf45e3441e07403a7015d40eb5ae3f0459667e4683c
MD5 8fee2f30376da50ade93c1c832a5e6c0
BLAKE2b-256 1109f9d266a1807af0ff68df84324b761d41bc65aff016f314c0013f2348b594

See more details on using hashes here.

Provenance

The following attestation bundles were made for xquik_haystack-0.1.0.tar.gz:

Publisher: release.yml on Xquik-dev/xquik-haystack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xquik_haystack-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: xquik_haystack-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for xquik_haystack-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e25a1a6a7b4e6e92fadc431c89e2a3334d6f7e94e0c2f9a689add44116f90510
MD5 ebe198818c9abfcd019ed64295a80f71
BLAKE2b-256 6aede2525ac1a68f112db806412f60721bd62df4e55a9bd9df006c6a6231734c

See more details on using hashes here.

Provenance

The following attestation bundles were made for xquik_haystack-0.1.0-py3-none-any.whl:

Publisher: release.yml on Xquik-dev/xquik-haystack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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