Skip to main content

TwAuto is a library for testing your code on pre-Twitter API application stage.

Project description

twAuto - Twitter Automation Tool v0.3.6 🦆

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.
)

- 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).

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

twAuto-0.3.6.tar.gz (8.8 kB view details)

Uploaded Source

Built Distribution

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

twAuto-0.3.6-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file twAuto-0.3.6.tar.gz.

File metadata

  • Download URL: twAuto-0.3.6.tar.gz
  • Upload date:
  • Size: 8.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for twAuto-0.3.6.tar.gz
Algorithm Hash digest
SHA256 8137fce6374ae24f1c84a20cb2ccfc6d84c4ac1eaff6ee6cd76c8304044174dd
MD5 d8e1efd00cd6c9bd49163ba4bb48e5d0
BLAKE2b-256 45a0c33f7ce02cacf3070dbe2b25209a2ef7fe8c59be4b832c719afaf3d13c87

See more details on using hashes here.

File details

Details for the file twAuto-0.3.6-py3-none-any.whl.

File metadata

  • Download URL: twAuto-0.3.6-py3-none-any.whl
  • Upload date:
  • Size: 7.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for twAuto-0.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7197a2a5e4c2b659981d3b41ae331db568058d2c9b38eab2810cf33117c6e00f
MD5 d2d362c2a13df51ac50fa45fdec7f6ca
BLAKE2b-256 7b5691399ac90146d31cf77cf3a2747a0c23b6158a5975ce379f87d07635db6a

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