Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
get Last update and notify to line channel
#!/usr/bin/env python
import requests
import datetime
import pickle
import github3
import humanize
import pytz
local_tz = pytz.timezone('Asia/Seoul')
auth_token = ''
# humanize.naturaltime
# get difference
def post_to_channel(message):"", data={"message": message},
headers={"Authorization": "Bearer " + auth_token})
def get_diff_human(last_update):
now =
delta = now - last_update
return humanize.naturaltime(delta)
def get_repo_last_update_dt(owner, repo):
repo = github3.repository(owner, repo)
return repo.updated_at.astimezone(local_tz)
def main():
members = (
('cjh5414', '',),
('hyesun03', '',),
('guswnsxodlf', '',),
reports = []
for owner, repo in members:
last_update = get_repo_last_update_dt(owner, repo)
diff_human = get_diff_human(last_update)
reports.append('%s : %s ( %s )' % (owner, diff_human, repo))
post_to_channel('\nBlog Repo Last Update\n' + '\n'.join(reports))
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.