A Python library for retrieving tweets from X (f.k.a. Twitter)
Project description
Python Tweet
About
pytweet
is a simple Python library with one goal: to retrieve tweet information from X for free.
Inspired by React-tweet project.
Key Feature
- doesn't require an X (formerly known as Twitter) API token
Installation
pip install python-tweet
From source:
make install
or
pip install .
Usage
It may cause conflicts with PyTweet if you are using it in your project.
Async way:
import asyncio
import json
from pytweet import get_tweet
async def main():
tweet_id = "1803774806980022720"
data = await get_tweet(tweet_id)
with open(f"{tweet_id}.json", "w") as f:
json.dump(data, f, indent=2)
if __name__ == '__main__':
asyncio.run(main())
Sync way:
import json
from pytweet.sync import get_tweet
def main():
tweet_id = "1803774806980022720"
data = get_tweet(tweet_id)
with open(f"{tweet_id}.json", "w") as f:
json.dump(data, f, indent=2)
if __name__ == '__main__':
main()
To-do
- Return a Tweet class instead a raw dict.
License
python-tweet
is released under the MIT License.
See the LICENSE file for license information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python_tweet-0.1.0.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for python_tweet-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b0316d4d7695f0ca514b8553070d12b34f55b7e620b3839fe30f872a299e2165 |
|
MD5 | c15f64bfc9086c4863bf2d6a06a1a8b7 |
|
BLAKE2b-256 | a4b3ec89cc19ac40e397d7690b36d3759263389e5423ddc75e99d15ca7dc85c6 |