79319827

Date: 2024-12-31 11:22:54
Score: 1.5
Natty:
Report link

Via the Stack Exchange API:

Here's a Python implementation, which uses StackAPI:

from stackapi import StackAPI
from datetime import datetime
from dateutil.relativedelta import relativedelta

year = (datetime.now() - relativedelta(years=1)).timestamp()

SITE = StackAPI('stackoverflow', key = '') # add your key

# fill user ids
user1 = 0
user2 = 0

# fetch all posts by user1 and user2 in the last year
posts = SITE.fetch(
    'users/{ids}/posts',
    ids=[user1, user2],
    filter='!*Ju*n-1rscDl8QtK',
    fromdate=round(year)
)
ids = [item['post_id'] for item in posts['items']]

# fetch the reputation history of user1 and user2
history = SITE.fetch('users/{ids}/reputation-history', ids=[user1,user2])
total1 = sum(item['reputation_change'] for item in history['items'] if item['post_id'] in ids and item['user_id'] == user1)
total2 = sum(item['reputation_change'] for item in history['items'] if item['post_id'] in ids and item['user_id'] == user2)
print(total1)
print(total2)

Make sure to register your application in order to obtain a key.

Reasons:
  • Blacklisted phrase (1): stackoverflow
  • RegEx Blacklisted phrase (1.5): reputation
  • RegEx Blacklisted phrase (1.5): the reputation
  • Long answer (-1):
  • Has code block (-0.5):
  • High reputation (-1):
Posted by: double-beep