Only apply recent changes.
New users and password changes should be applied, but updaging all users all the time would waste processing.
This commit is contained in:
parent
e2edf809cb
commit
30e7d74bab
1 changed files with 9 additions and 2 deletions
11
poll.py
11
poll.py
|
@ -1,4 +1,5 @@
|
|||
#! /bin/env python3
|
||||
from datetime import datetime, timezone, timedelta
|
||||
from requests import get, post, patch
|
||||
from os import getenv
|
||||
import logging
|
||||
|
@ -9,9 +10,15 @@ fingerpass = getenv('FINGER_PW')
|
|||
|
||||
gitauth = (getenv('GIT_USER'), getenv('GIT_PW'))
|
||||
|
||||
fingerurl = f'https://finger.stacken.kth.se/services/git/all'
|
||||
|
||||
response = get(fingerurl, auth=('git', fingerpass))
|
||||
fingerurl = f'https://finger.stacken.kth.se/services/git/all'
|
||||
query = {}
|
||||
|
||||
if True:
|
||||
since = datetime.now(timezone.utc) - timedelta(minutes=30)
|
||||
query['since'] = since.strftime("%Y-%m-%dT%T%Z")
|
||||
|
||||
response = get(fingerurl, params=query, auth=('git', fingerpass))
|
||||
response.raise_for_status()
|
||||
|
||||
for (user, passwd) in response.json().items():
|
||||
|
|
Loading…
Add table
Reference in a new issue