Skip to main content

twAuto - Twitter Automation Tool v0.4.0 🦆 PyPI Downloads

twAuto is a library for "Tweeting", "Retweeting", "Replying", "Tweet Quoting", "Tweet Liking" without any API requirements using Selenium.


Note: While using this library I didnt encounter any problems/bad response from Twitter like banning account etc. but please use at your own risk.

Requirements

Installation

Pip:

pip3 install twAuto

Functions

- Import:

import twAuto

- Configure:

tw = twAuto.twAuto(
  username="Your Twitter Username",
  email="Your Twitter E-Mail",
  password="Your Twitter Password",
  chromeDriverMode="manual" or "auto", #if you use auto twAuto will automatically download the chrome driver for you,
                                       #if you use the manual option, you need to provide the driver path in driverPath parameter.
  driverPath="your drivers path", #use only if you are using the chromeDriverMode in manual mode
  pathType="testId" or "xPath", #It is testId by default. I highly recommend you to use testId instead of xPath. If you had any problems with library you can try the xPath mode too.
  headless=True/False, #Headless is true by default.
  debugMode= True/False #Really poorly implemented debug mode, this is for reading occured errors.
                        #It is not reliable right now but you can give it a try if you want to.
  createCookies= True/False #True by default.
)

- Start: Start functions runs the selenium driver.

tw.start()

- Login: Logs in to the Twitter account

tw.login()

- Login Errors: If you encounter any errors in the login process, you can use manualCookieCreation() to get your cookie file manually. Run the function after tw.start() line. Then after the browser window opened, login to account you want to automate, then enter any character in the terminal. This will create a cookie file after this, you can use the library.

Note: Headless must be False to use this function.

tw.manualCookieCreation()

Example:

First run this code to get your cookie file.

tw = twAuto.twAuto(
  username="Your Twitter Username",
  email="Your Twitter E-Mail",
  password="Your Twitter Password",
  chromeDriverMode="auto",
  pathType="xPath",
  headless=False #Headless must be False to use this function.
)

tw.start()
tw.manualCookieCreation()

After doing the steps that is described above, you can run your main code.

tw = twAuto.twAuto(
  username="Your Twitter Username",
  email="Your Twitter E-Mail",
  password="Your Twitter Password",
  chromeDriverMode="auto",
  pathType="xPath"
)

tw.start()
tw.login()
#other functions...

- Like: Likes tweet in the given url
->Returns: True/False as Success/Failed

tw.like(url="")

- Reply: Replies to the tweet in the given url with given text.
->Returns: Reply URL/False

tw.reply(url="", imgpath="", text="")

- Tweet: Tweets the text and image if given.
->Returns: Tweet URL/False

tw.tweet(text="",imgpath="")

- Quote Tweet: Quotes the tweet in the given url with the given text.
->Returns: Quoted Tweet URL/False

tw.quoteTweet(url="", imgpath="" ,text="")

- Retweet: Retweets the tweet in the given url.
->Returns: True/False as Success/Failed

tw.retweet(url="")

- Unretweet: Unretweets the tweet in the given url.
->Returns: True/False as Success/Failed

tw.unretweet(url="")

- Logout: Logs out from current Twitter account and deletes the cookies file.

tw.logout()

- Quit/Close: Ends the session, closes the selenium driver application

tw.close()

Example Code

tw = twAuto.twAuto(
  username="",
  email="",
  password="",
  headless=True,
  chromeDriverMode="auto",
  pathType="testId")

tw.start()
tw.login()

tw.reply(url="",imgpath="", text="")

tw.close()

To Do's 📝 :

  • Send image with Quote, Reply.
  • Send gif with Quote, Reply.
  • Retweet without adding url at the end.
  • Linux integration(not tested yet).

Metadata

Release files for twAuto 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for twAuto 0.4.0
File Size Uploaded Provenance Actions
twAuto-0.4.0.tar.gz 9.2 kB Without provenance Details for twAuto-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for twAuto 0.4.0
File Interpreter ABI Platform Actions
twAuto-0.4.0-py3-none-any.whl Python 3 none any Details for twAuto-0.4.0-py3-none-any.whl

Total release size: 17.1 kB

Release files / twAuto-0.4.0.tar.gz

Download URL twAuto-0.4.0.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
91cb4e2c124b2f18786443672da83502a009544b51c53e19901a76e277829164
BLAKE2b-256 checksum
How to use checksums
7ab57217127a6b96cc28a1ba15ef3c2d8e53b9b97261cb236268fb7e87055123
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Release files / twAuto-0.4.0-py3-none-any.whl

Download URL twAuto-0.4.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
078baac0e45295fdcec1e80b5d49c3789321d809c362a7117d08715cca10e715
BLAKE2b-256 checksum
How to use checksums
bdebaa2fc5d2e7a2f57e41b88541d9106dd1e9b25baff844499f3d9e0f0624a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.18

Security for twAuto 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page