Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added python script for stackoverflow #108

Merged
merged 3 commits into from
Oct 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Automation/src/Scripts_For_Stackoverflow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# StackOverflow_badge_counter
## Motivation for this script
I have a tendency to go to the stackoverflow website again and again to check my reputation and badges. So I made this sctipt to automate the process.<br>
## What this script does
This python scripts counts the gold, silver and bronze badges earned by the user. It also shows the user's current reputation as well as by how much the reputation has changed on that particular date, week.<br>
## Caution!!!
Make sure you replace the user_id variable on the first line of the script to your user id which can be found on the stackoverflow website. User id can be found beside the stackoverflow icon if you go to your profile page.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
user_id = '22656'
url = 'http://api.stackexchange.com/2.2/users/'+user_id+'?order=desc&sort=reputation&site=stackoverflow'
import requests
response = requests.get(url)
json = response.json()
print('Total medals = {}'.format(json['items'][0]['badge_counts']['gold']+json['items'][0]['badge_counts']['silver']+json['items'][0]['badge_counts']['bronze']))
print('Bronze = {}'.format(json['items'][0]['badge_counts']['bronze']))
print('Silver = {}'.format(json['items'][0]['badge_counts']['silver']))
print('Gold = {}'.format(json['items'][0]['badge_counts']['gold']))
print('Current reputation = {}'.format(json['items'][0]['reputation']))
print('Reputation change today = {}'.format(json['items'][0]['reputation_change_day']))
print('Reputation change this week = {}'.format(json['items'][0]['reputation_change_week']))