From 6e81ea4ddce5cc800b5917e0269df2d875b1e82e Mon Sep 17 00:00:00 2001 From: Guruji-D-Gr8 Date: Sat, 20 Oct 2018 17:27:11 +0530 Subject: [PATCH 1/3] added script for badge count in stackoverflow --- Automation/src/Scripts_For_Stackoverflow/README.md | 7 +++++++ .../StackOverflow_badge_counter.py | 12 ++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 Automation/src/Scripts_For_Stackoverflow/README.md create mode 100644 Automation/src/Scripts_For_Stackoverflow/StackOverflow_badge_counter.py diff --git a/Automation/src/Scripts_For_Stackoverflow/README.md b/Automation/src/Scripts_For_Stackoverflow/README.md new file mode 100644 index 00000000..59eda095 --- /dev/null +++ b/Automation/src/Scripts_For_Stackoverflow/README.md @@ -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.
+## 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.
+## 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. diff --git a/Automation/src/Scripts_For_Stackoverflow/StackOverflow_badge_counter.py b/Automation/src/Scripts_For_Stackoverflow/StackOverflow_badge_counter.py new file mode 100644 index 00000000..26b545cd --- /dev/null +++ b/Automation/src/Scripts_For_Stackoverflow/StackOverflow_badge_counter.py @@ -0,0 +1,12 @@ +user_id = '8182933' +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'])) \ No newline at end of file From 7c11e2497d4ca510391137d1a0061ab163eab4bd Mon Sep 17 00:00:00 2001 From: Guruji-D-Gr8 Date: Sat, 20 Oct 2018 17:46:55 +0530 Subject: [PATCH 2/3] added user_id --- Automation/src/Scripts_For_Stackoverflow/README.md | 4 ++-- .../Scripts_For_Stackoverflow/StackOverflow_badge_counter.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Automation/src/Scripts_For_Stackoverflow/README.md b/Automation/src/Scripts_For_Stackoverflow/README.md index 59eda095..8c17a6ed 100644 --- a/Automation/src/Scripts_For_Stackoverflow/README.md +++ b/Automation/src/Scripts_For_Stackoverflow/README.md @@ -3,5 +3,5 @@ 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.
## 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.
-## 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. +## 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. diff --git a/Automation/src/Scripts_For_Stackoverflow/StackOverflow_badge_counter.py b/Automation/src/Scripts_For_Stackoverflow/StackOverflow_badge_counter.py index 26b545cd..e6b4ba73 100644 --- a/Automation/src/Scripts_For_Stackoverflow/StackOverflow_badge_counter.py +++ b/Automation/src/Scripts_For_Stackoverflow/StackOverflow_badge_counter.py @@ -1,4 +1,4 @@ -user_id = '8182933' +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) @@ -9,4 +9,4 @@ 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'])) \ No newline at end of file +print('Reputation change this week = {}'.format(json['items'][0]['reputation_change_week'])) From f0dcea6bd7a06b23b43fba3f9f6345c3ea3b7cb9 Mon Sep 17 00:00:00 2001 From: Guruji-D-Gr8 Date: Sat, 20 Oct 2018 17:48:37 +0530 Subject: [PATCH 3/3] updated README --- Automation/src/Scripts_For_Stackoverflow/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Automation/src/Scripts_For_Stackoverflow/README.md b/Automation/src/Scripts_For_Stackoverflow/README.md index 8c17a6ed..f93b9f98 100644 --- a/Automation/src/Scripts_For_Stackoverflow/README.md +++ b/Automation/src/Scripts_For_Stackoverflow/README.md @@ -4,4 +4,4 @@ I have a tendency to go to the stackoverflow website again and again to check my ## 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.
## 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. +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.