Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9e727c8

Browse files
committed
更新:github_bot脚本
1 parent 5b12b0f commit 9e727c8

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

script/README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
**最后:**`python github_bot.py`
3333

3434
## 开发日志
35+
#### 2016-9-29
36+
- Github今日热点项目不统计自己的项目
37+
- 错误日志放到脚本的同目录下
38+
3539
#### 2016-9-24
3640
实现根据star数量,从高到低展示。
3741
#### 2016-9-5
@@ -41,3 +45,4 @@ Todo:
4145

4246
1. 获取explore页的数据
4347
2. 异步请求获取star数
48+
3. 自己项目的数据统计

script/github_bot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
logging.basicConfig(
1919
level=logging.WARNING,
20-
filename=os.path.join(os.getcwd(), 'bot_log.txt'),
20+
filename=os.path.join(os.path.dirname(__file__), 'bot_log.txt'),
2121
filemode='a',
2222
format='%(name)s %(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s'
2323
)
@@ -92,7 +92,9 @@ def check_condition(data):
9292
date_condition = create_time >= (datetime.datetime.now()
9393
- datetime.timedelta(days=DAY))
9494
if (data['type'] == 'WatchEvent') and date_condition:
95-
if data['payload']['action'] == 'started':
95+
# 不统计自己项目的star事件
96+
if data['payload']['action'] == 'started' and \
97+
ACCOUNT['username'] not in data['repo']['name']:
9698
data['date_time'] = create_time.strftime("%Y-%m-%d %H:%M:%S")
9799
return True
98100
else:

0 commit comments

Comments
 (0)