-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgithub_followers.py
More file actions
executable file
·71 lines (51 loc) · 1.43 KB
/
github_followers.py
File metadata and controls
executable file
·71 lines (51 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# -*- coding: utf-8 -*-
# @Author: rizwan
# @Date: 2018-11-23 16:40:43
# @Last Modified by: Tanzim Rizwan
# @Last Modified time: 2020-03-27 12:32:52
import os
import requests
import platform
FILE_PATH = os.path.abspath(__file__)
BASE_DIR = os.path.dirname(FILE_PATH)
def check_new(flist):
fdata = []
Followers = []
followers_file_path = os.path.join(BASE_DIR,'followers.txt')
if os.path.exists(followers_file_path):
with open(followers_file_path, 'r') as rfile:
for line in rfile:
line = line.strip()
fdata.append(line)
with open(followers_file_path, 'a') as wfile:
for i in flist:
if i in fdata:
# print("Exists!!")
pass
else:
Followers.append(i)
wfile.write(i + '\n')
if Followers:
title = "New Follower!!!"
sys_name = platform.system()
if sys_name=="Linux":
os.system('/usr/bin/notify-send " '+title+' " " '+'\n'.join(Followers)+' " ')
else:
print("******************************")
print("You are not using Linux System.\nWindows SUCKS")
print("******************************")
for f in Followers:
print(f)
def follower_list():
username = "brainaxe" # <----- SET YOUR USERNAME HERE
api = 'https://api.github.com/users/{}/followers'.format(username)
r = requests.get(api)
data = r.json()
followers = []
for i in data:
follower = i['login']
followers.append(follower)
return followers
if __name__ == '__main__':
flist = follower_list()
check_new(flist)