Skip to content

alexsomai/stackoverflow-fanatic-badge

Repository files navigation

Earn the Fanatic Badge on Stack Overflow

A Python script deployed to Heroku that performs automatic logins on stackoverflow.com on a regular basis, so that you can earn the Fanatic badge, effortlessly.

Fanatic Badge

Visit the site each day for 100 consecutive days. (Days are counted in UTC.).

Moreover, you get notified, via email, if the script goes wrong and you haven’t logged into Stack Overflow for at least twelve hours.

ℹ️ To count as a visit, besides the login, the script also accesses your profile page: https://meta.stackoverflow.com/a/298532.

Step-by-step guide

You may follow the step-by-step guide here.

And the second part, with additional improvements, here.

Alternatively, you can follow the (less detailed) quick start below.

Quick start

  1. Make sure you have the following dependencies:

    • Python 3.6+ (along with pip)

    • Chrome installed (or another browser of choice, though you will have to edit the script)

    • Python packages (use pip install to get): selenium, sendgrid, webdriver_manager, requests_oauthlib, apscheduler, requests, python_http_client

  2. Edit .env to include your email, password, and display name.

    • WARNING: don't push this to a public repository!
  3. Run python3 stack_overflow_page.py to see the script work.

  4. If you want to be notified by email when things go wrong, sign up for sendgrid to get an API key, and add that to env_vars.txt as well. This can take some work to set up successfully.

  5. To schedule the script on Heroku, sign up for an account on Heroku and follow the instructions in the full step-by-step guide on Medium. Or press the Deploy to Heroku button below.

Deploy to Heroku

Deploy

Once deployed, set the following Config Vars in Heroku app Settings:

  • Mandatory (basic login script variables):

    • STACK_OVERFLOW_EMAIL
    • STACK_OVERFLOW_PASSWORD
    • STACK_OVERFLOW_DISPLAY_NAME
  • Optional:

    • Sendgrid, for sending email when things go wrong:
      • SENDGRID_API_KEY
    • Stack Exchange API, to get an email after a period of inactivity:
      • STACK_EXCHANGE_CLIENT_ID
      • STACK_EXCHANGE_KEY
      • STACK_EXCHANGE_ACCESS_TOKEN

Troubleshooting

The script can trigger a CAPTCHA from StackOverflow. A human has to resolve this.

StackOverflow sometimes changes their UI, so that the old CSS identifiers don't match anymore. This can cause one of lines in stack_overflow_page.py starting with driver.find_element_by_ to fail. To debug this in Chrome, look for the correct identifier to use instead using the "inspect element" feature in developer tools (Ctrl+Shift+C).

Emails sent by sendgrid can go to spam. If you get errors when sending mail with sendgrid, make sure that you have an account which includes an API key, a verified email address, and that you have set up a verified sender to send mail. Note that sendgrid requires the dependency python-http-client.

About

A script deployed to Heroku that logs into Stack Overflow on a regular basis to earn the Fanatic badge 🎖️

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published