Skip to content

Commit b1dfb64

Browse files
authored
Merge pull request #108 from y-pankaj/master
Added python script for Stackoverflow
2 parents 4815782 + f0dcea6 commit b1dfb64

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# StackOverflow_badge_counter
2+
## Motivation for this script
3+
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>
4+
## What this script does
5+
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>
6+
## Caution!!!
7+
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 numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
user_id = '22656'
2+
url = 'http://api.stackexchange.com/2.2/users/'+user_id+'?order=desc&sort=reputation&site=stackoverflow'
3+
import requests
4+
response = requests.get(url)
5+
json = response.json()
6+
print('Total medals = {}'.format(json['items'][0]['badge_counts']['gold']+json['items'][0]['badge_counts']['silver']+json['items'][0]['badge_counts']['bronze']))
7+
print('Bronze = {}'.format(json['items'][0]['badge_counts']['bronze']))
8+
print('Silver = {}'.format(json['items'][0]['badge_counts']['silver']))
9+
print('Gold = {}'.format(json['items'][0]['badge_counts']['gold']))
10+
print('Current reputation = {}'.format(json['items'][0]['reputation']))
11+
print('Reputation change today = {}'.format(json['items'][0]['reputation_change_day']))
12+
print('Reputation change this week = {}'.format(json['items'][0]['reputation_change_week']))

0 commit comments

Comments
 (0)