Skip to content

Commit

Permalink
====feat: 添加根据last_activity_at时间来过滤项目====
Browse files Browse the repository at this point in the history
  • Loading branch information
miaoyc666 committed Feb 14, 2022
1 parent 3065ec9 commit 2656f6c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def get_projects(self):
r2 = r1.json() # 显示json字符串
for r3 in r2:
name_with_namespace = r3["name_with_namespace"]
if time.strptime(r3["last_activity_at"][:19], "%Y-%m-%dT%H:%M:%S") < \
time.strptime(config.t_from, "%Y-%m-%d %H:%M:%S"):
continue
if name_with_namespace not in config.valid_project:
continue
value = r3['default_branch']
Expand Down
10 changes: 6 additions & 4 deletions src/run_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
Description :
"""

import requests
import os
import json
import time
import datetime
import requests
from urllib import parse

import config as config
Expand Down Expand Up @@ -46,10 +47,11 @@ def get_projects(self):
r1 = requests.get(url) # 请求url,传入header,ssl认证为false
r2 = r1.json() # 显示json字符串
for r3 in r2:
# todo: 添加根据last_activity_at时间来过滤项目
# print(r3["last_activity_at"], type(r3["last_activity_at"]))
name_with_namespace = r3["name_with_namespace"]
print(name_with_namespace)
if time.strptime(r3["last_activity_at"][:19], "%Y-%m-%dT%H:%M:%S") < \
time.strptime(config.t_from, "%Y-%m-%d %H:%M:%S"):
continue
print(name_with_namespace, r3["last_activity_at"][:19])
if name_with_namespace not in config.valid_project:
continue
value = r3['default_branch']
Expand Down

0 comments on commit 2656f6c

Please sign in to comment.