Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8dbcc4a

Browse files
Added data prepration.
1 parent 09b5bf2 commit 8dbcc4a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

‎main.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from github import Github
2+
from datetime import datetime
3+
import time
4+
import os
5+
6+
ACCESS_TOKEN = open("token.txt", "r").read()
7+
github = Github(ACCESS_TOKEN)
8+
9+
SECONDS_IN_A_DAY = 86400
10+
11+
end_time = time.time()
12+
start_time = end_time - SECONDS_IN_A_DAY
13+
14+
for i in range(3):
15+
start_time_str = datetime.utcfromtimestamp(start_time).strftime("%Y-%m-%d")
16+
end_time_str = datetime.utcfromtimestamp(end_time).strftime("%Y-%m-%d")
17+
18+
query = f"language:python created:{start_time_str}..{end_time_str}"
19+
print(query)
20+
21+
start_time -= SECONDS_IN_A_DAY
22+
end_time -= SECONDS_IN_A_DAY
23+
24+
result = github.search_repositories(query)
25+
print(result.totalCount)
26+
27+
for repository in result:
28+
print(repository.clone_url)
29+
os.system(f"git clone {repository.clone_url} repos/{repository.owner.login}/{repository.name}")
30+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /