/
create_new_repo.py
63 lines (45 loc) · 2.05 KB
/
create_new_repo.py
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
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.chrome.options import Options
import time
import gen
import get_code_gmail
options = webdriver.ChromeOptions()
options.add_argument("start-maximized")
#options.add_argument('headless') #uncomment if u want no gui feedback.
options.add_experimental_option("excludeSwitches",["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
web = webdriver.Chrome(options=options)
wait = WebDriverWait(web,10)
web.get('https://www.github.com/login')
username = '' #username here
password = '' #password here
reponame = gen.gen()+'-active-boosted'
reporm = "Boosted repo added to fill git activity grid. For details, check out github-activity-booster."
time.sleep(2)
user = web.find_element_by_id('login_field')
user.send_keys(username)
pw = web.find_element_by_id('password')
pw.send_keys(password)
time.sleep(1)
web.find_element_by_xpath('/html/body/div[3]/main/div/form/div[4]/input[9]').click()
while(web.current_url=='https://github.com/sessions/verified-device'):
time.sleep(3)
try:
code = get_code_gmail.main()
web.find_element_by_id('otp').send_keys(code)
web.find_element_by_xpath('/html/body/div[3]/main/div/div[3]/form/button').click()
except:
web.find_element_by_xpath('/html/body/div[3]/main/div/div[4]/form/button').click()
time.sleep(2)
web.find_element_by_xpath('/html/body/div[4]/div/aside[1]/div[2]/div[2]/div/h2/a').click()
time.sleep(2)
web.find_element_by_id('repository_name').send_keys(reponame)
web.find_element_by_id('repository_auto_init').click()
web.find_element_by_id('repository_description').send_keys(reporm)
web.find_element_by_xpath('/html/body/div[4]/main/div/form/div[3]/button').click()
with open('reponame','w') as f:
f.write(reponame)