Twitter autofollow and direct message using python mechanize libgmail


  • a valid gmail account
  • label your twitter follow notifications (E.g. I use TwitterFollow)
  • mechanize : a stateful programmatic web browsing
  • libgmail : a GA reverse engineered library
  • python-twitter : a wrapper around the Twitter API

IMPORTANT: because Gmail does not provide an API and does not intend to do that because of the ads, hacking libgmail to fetch the threads is a VIOLATION of Gmail TOS. This script should be use for documentation only. For production please consider using POP3 or IMAP to fetch the threads. To avoid your account being suspended or locked run the script no more than twice a day.