Name | twot JSON |
Version |
0.0.4
JSON |
| download |
home_page | |
Summary | The Twitter Bot API - Tweet, Follow, Like, Retweet, and more with Python without using Twitter's API |
upload_time | 2023-04-21 21:15:30 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.7 |
license | |
keywords |
twitter
twitter-api
twitter-bot
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# twot - The Twitter Bot API
![PyPI](https://img.shields.io/pypi/v/twot)
![GitHub](https://img.shields.io/github/license/gpl27/twot)
## About
This is a Python package that provides an easy-to-use interface to
Twitter using Selenium to emulate actions that a Twitter user might make,
such as liking, following, and tweeting. In addition, it provides a
Tweet Search implementation that uses Twitter's Advanced Search to
scrape for tweets.
## Getting Started
### Prerequisites
To use this package, you will need:
- Python 3.7+
- Selenium 4.0+
- Chrome Browser
- Twitter Account
### Installation
1. `pip install twot`
### Usage
2. Import `TwitterAPI` class, create an instance and login:
```python
from twot.classes import TwitterAPI
api = TwitterAPI('my_username', 'my_password')
api.login()
```
3. Use the `TwitterAPI` instance to interact with Twitter:
```python
# Tweet something
api.post_tweet('Hello World!')
# Like a tweet
api.like_tweet('https://twitter.com/twitter/status/1234567890')
# Quote retweet a tweet
api.quote_retweet('https://twitter.com/twitter/status/1234567890', 'Foo bar')
```
4. Scrape for tweets:
```python
# First five options are required for every search
OPTIONS = {
"limit": 500,
"replies": False,
"only-replies": False,
"links": True,
"only-links": False,
"from": ['BarackObama']
}
# Links to the last 500 tweets from Obama
obama_tweets = api.search(OPTIONS)
```
## Features
You must have a Twitter account to use all features (including search).
Class methods return the results of their actions. For example, methods
that post a tweet return a link to the new tweet. Likeing and following
return whether that tweet/account is now liked/followed or unliked/unfollowed
(true/false).
```
Methods
-------
status()
Prints general info about the class state
login()
Uses `username` and `password` to login to Twitter
logout()
Logs out from Twitter
post_tweet(message)
Posts a tweet to users timeline
reply_to_tweet(tweet_id, message)
Posts a reply to the specified tweet
like_tweet(tweet_id)
Likes/Unlikes the tweet
retweet(tweet_id)
Retweets/Unretweets the tweet
quote_retweet(tweet_id, message)
Quote retweets the tweet with the specified message
follow(user_handle)
Follows the user with the specified handle
unfollow(user_handle)
Unfollows the user with the specified handle
search(options)
Searches for tweets using Advanced Search
quit()
Ends the browser session
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to
discuss what you would like to change.
Raw data
{
"_id": null,
"home_page": "",
"name": "twot",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "twitter,twitter-api,twitter-bot",
"author": "",
"author_email": "gpl27 <gpl27.dev@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/8a/82/6934365de13b5dc2cfbf275f13d8780cfa05710c415c6aa718204d5549fa/twot-0.0.4.tar.gz",
"platform": null,
"description": "# twot - The Twitter Bot API\n![PyPI](https://img.shields.io/pypi/v/twot)\n![GitHub](https://img.shields.io/github/license/gpl27/twot)\n## About\nThis is a Python package that provides an easy-to-use interface to \nTwitter using Selenium to emulate actions that a Twitter user might make,\nsuch as liking, following, and tweeting. In addition, it provides a \nTweet Search implementation that uses Twitter's Advanced Search to\nscrape for tweets.\n\n## Getting Started\n### Prerequisites\nTo use this package, you will need:\n- Python 3.7+\n- Selenium 4.0+\n- Chrome Browser\n- Twitter Account\n### Installation\n1. `pip install twot`\n### Usage\n2. Import `TwitterAPI` class, create an instance and login:\n```python\nfrom twot.classes import TwitterAPI\n\napi = TwitterAPI('my_username', 'my_password')\napi.login()\n```\n3. Use the `TwitterAPI` instance to interact with Twitter:\n```python\n# Tweet something\napi.post_tweet('Hello World!')\n\n# Like a tweet\napi.like_tweet('https://twitter.com/twitter/status/1234567890')\n\n# Quote retweet a tweet\napi.quote_retweet('https://twitter.com/twitter/status/1234567890', 'Foo bar')\n\n```\n4. Scrape for tweets:\n```python\n# First five options are required for every search\nOPTIONS = {\n \"limit\": 500,\n \"replies\": False,\n \"only-replies\": False,\n \"links\": True,\n \"only-links\": False,\n \"from\": ['BarackObama']\n}\n# Links to the last 500 tweets from Obama\nobama_tweets = api.search(OPTIONS)\n\n```\n## Features\nYou must have a Twitter account to use all features (including search).\nClass methods return the results of their actions. For example, methods\nthat post a tweet return a link to the new tweet. Likeing and following\nreturn whether that tweet/account is now liked/followed or unliked/unfollowed\n(true/false).\n```\n Methods\n -------\n status()\n Prints general info about the class state\n login()\n Uses `username` and `password` to login to Twitter\n logout()\n Logs out from Twitter\n post_tweet(message)\n Posts a tweet to users timeline\n reply_to_tweet(tweet_id, message)\n Posts a reply to the specified tweet\n like_tweet(tweet_id)\n Likes/Unlikes the tweet\n retweet(tweet_id)\n Retweets/Unretweets the tweet\n quote_retweet(tweet_id, message)\n Quote retweets the tweet with the specified message\n follow(user_handle)\n Follows the user with the specified handle\n unfollow(user_handle)\n Unfollows the user with the specified handle\n search(options)\n Searches for tweets using Advanced Search\n quit()\n Ends the browser session\n\n```\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to\ndiscuss what you would like to change.\n",
"bugtrack_url": null,
"license": "",
"summary": "The Twitter Bot API - Tweet, Follow, Like, Retweet, and more with Python without using Twitter's API",
"version": "0.0.4",
"split_keywords": [
"twitter",
"twitter-api",
"twitter-bot"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9473ebea0931639040a76a1b0e75b9dad8774e984cd8534299072c485c32a28a",
"md5": "d25c49980bdbc61e0a90d24e73f7e72a",
"sha256": "9b7febe913f12b0475401331997b8acd77160898fff33c4de0f07bfc0d4a5810"
},
"downloads": -1,
"filename": "twot-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d25c49980bdbc61e0a90d24e73f7e72a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7803,
"upload_time": "2023-04-21T21:15:27",
"upload_time_iso_8601": "2023-04-21T21:15:27.772597Z",
"url": "https://files.pythonhosted.org/packages/94/73/ebea0931639040a76a1b0e75b9dad8774e984cd8534299072c485c32a28a/twot-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8a826934365de13b5dc2cfbf275f13d8780cfa05710c415c6aa718204d5549fa",
"md5": "0ed5b22a40f890533c1bb4e6817bb6c5",
"sha256": "2572a68d2095b92f748bc28fb8a54db00dbae828b0f5f551372e844777cf9aab"
},
"downloads": -1,
"filename": "twot-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "0ed5b22a40f890533c1bb4e6817bb6c5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 6538,
"upload_time": "2023-04-21T21:15:30",
"upload_time_iso_8601": "2023-04-21T21:15:30.718792Z",
"url": "https://files.pythonhosted.org/packages/8a/82/6934365de13b5dc2cfbf275f13d8780cfa05710c415c6aa718204d5549fa/twot-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-04-21 21:15:30",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "twot"
}