Skip to main content

No project description provided

Project description

SPARTA Twitter API

Linting Status Test Status Build Status Python Version License Checked with mypy

Welcome to the official GitHub repository for the SPARTA Twitter API, a powerful Python implementation to interact with Twitter's API v2 in a robust and efficient manner.

🚀 Features

  • Methods for gathering tweets, users and more.
  • Asynchronous API calls support.
  • Efficient error handling and rate limit management.
  • Comprehensive documentation with usage examples.

📦 Installation

We recommend using Poetry for managing the project dependencies. If you don't have Poetry installed, check their official documentation for guidance.

To install the SPARTA Twitter API via Poetry:

poetry add sparta-twitterapi

or to install it via pip:

pip3 install sparta-twitterapi

📝 Quick Start

Here's a simple example to get you started:

import os
os.environ["BEARER_TOKEN"] = "XXXXXXXXXXXXXX"
from sparta.twitterapi.tweets.tweets import get_tweets_by_id

async for tweet_response in get_tweets_by_id(['1511275800758300675', '1546866845180887040']):
    print(tweet_response.tweet)

For in-depth methods and examples, consult our official documentation.

🛠 Development & Contribution

Clone the Repo:

git clone https://github.com/UnibwSparta/twitterapi.git
cd twitterapi

Install Dependencies:

poetry install

Submit Your Changes: Make your improvements and propose a Pull Request!

🧪 Testing

Tests are powered by pytest. Execute tests with:

poetry run pytest tests/

❓ Support & Feedback

Issues? Feedback? Use the GitHub issue tracker.

📜 License

MIT License. View LICENSE for details.

Create twitter spec

Install datamodel-code-generator

pip3 install datamodel-code-generator

Download the OpenAPI spec

wget https://api.twitter.com/2/openapi.json

Create the model and make the manual changes that are described at the top of models/twitter_v2_spec.py

datamodel-codegen --input openapi.json --input-file-type openapi --output model.py --output-model-type pydantic_v2.BaseModel --collapse-root-models --use-double-quotes

Project SPARTA

SPARTA is an interdisciplinary research project at the UniBw M. The Chair of Political Science is responsible for managing the project. The project is funded by dtec.bw (Digitalization and Technology Research Center of the Bundeswehr). dtec.bw is funded by the European Union - NextGenerationEU.

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

sparta_twitterapi-0.1.65.tar.gz (49.1 kB view details)

Uploaded Source

Built Distribution

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

sparta_twitterapi-0.1.65-py3-none-any.whl (64.4 kB view details)

Uploaded Python 3

File details

Details for the file sparta_twitterapi-0.1.65.tar.gz.

File metadata

  • Download URL: sparta_twitterapi-0.1.65.tar.gz
  • Upload date:
  • Size: 49.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sparta_twitterapi-0.1.65.tar.gz
Algorithm Hash digest
SHA256 f718a0b4aef86246b8be84820eae5ddfd8f8f6983b805e47f2cab5d63a7851f5
MD5 22672c0cf19caadbba564de5f13a71c4
BLAKE2b-256 f131f017a4549d6077c26244a11b3e9c51a2da86cf295d6c1efb2687ac9f9743

See more details on using hashes here.

File details

Details for the file sparta_twitterapi-0.1.65-py3-none-any.whl.

File metadata

File hashes

Hashes for sparta_twitterapi-0.1.65-py3-none-any.whl
Algorithm Hash digest
SHA256 1ec83ac86ad0df4ac1518ff34b4a15df299e2e469c82ea46b2d59ba9224077d3
MD5 6610b4f1608b3e1ded11026965b4f553
BLAKE2b-256 22de9bfe46915d2599c794e084d137308061ab57caa30d37b38c148b5c7a9a19

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