Skip to content

Commit aee88e6

Browse files
committed
move path to config and add time.sleep when download
1 parent 1f9c6f9 commit aee88e6

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# :pencil2: Leetcode Solutions with Python,Javascript
2-
Update time: 2018-03-30 15:19:58
2+
Update time: 2018-04-02 09:55:57
33

44
Auto created by [leetcode_generate](https://github.com/bonfy/leetcode)
55

6-
I have solved **97 / 722** problems
6+
I have solved **97 / 726** problems
77
while there are **133** problems still locked.
88

99
If you want to use this tool please follow this [Usage Guide](https://github.com/bonfy/leetcode/blob/master/README_leetcode_generate.md)
@@ -738,3 +738,7 @@ If you are loving solving problems in leetcode, please contact me to enjoy it to
738738
|823|[split-array-with-same-average](https://leetcode.com/problems/split-array-with-same-average)||[:memo:](https://leetcode.com/articles/split-array-with-same-average/)|Hard|
739739
|824|[number-of-lines-to-write-string](https://leetcode.com/problems/number-of-lines-to-write-string)||[:memo:](https://leetcode.com/articles/number-of-lines-to-write-string/)|Easy|
740740
|825|[max-increase-to-keep-city-skyline](https://leetcode.com/problems/max-increase-to-keep-city-skyline)||[:memo:](https://leetcode.com/articles/max-increase-to-keep-city-skyline/)|Medium|
741+
|826|[soup-servings](https://leetcode.com/problems/soup-servings)||[:memo:](https://leetcode.com/articles/soup-servings/)|Medium|
742+
|827|[expressive-words](https://leetcode.com/problems/expressive-words)||[:memo:](https://leetcode.com/articles/expressive-words/)|Medium|
743+
|828|[chalkboard-xor-game](https://leetcode.com/problems/chalkboard-xor-game)||[:memo:](https://leetcode.com/articles/chalkboard-xor-game/)|Hard|
744+
|829|[subdomain-visit-count](https://leetcode.com/problems/subdomain-visit-count)||[:memo:](https://leetcode.com/articles/subdomain-visit-count/)|Easy|

leetcode_generate.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,14 @@ def get_config_from_file():
5959
if not repo:
6060
raise Exception('Please input your Github repo address')
6161

62+
driverpath = cp.get('leetcode', 'driverpath')
63+
6264
rst = dict(
6365
username=username,
6466
password=password,
6567
language=language.lower(),
6668
repo=repo,
69+
driverpath=driverpath,
6770
)
6871
return rst
6972

@@ -193,9 +196,9 @@ def login(self):
193196
pwd = CONFIG['password']
194197
# driver = webdriver.PhantomJS()
195198
options = webdriver.ChromeOptions()
196-
# options.add_argument('headless')
199+
options.add_argument('headless')
197200
options.add_argument('--disable-gpu')
198-
executable_path = '/usr/local/bin/chromedriver'
201+
executable_path = CONFIG.get('driverpath')
199202
driver = webdriver.Chrome(
200203
chrome_options=options, executable_path=executable_path
201204
)
@@ -473,14 +476,13 @@ def download(self):
473476
""" download all solutions with single thread """
474477
ac_items = [i for i in self.items if i.is_pass]
475478
for quiz in ac_items:
479+
time.sleep(1)
476480
self._download_code_by_quiz(quiz)
477481

478482
def download_with_thread_pool(self):
479483
""" download all solutions with multi thread """
480484
ac_items = [i for i in self.items if i.is_pass]
481-
482485
from concurrent.futures import ThreadPoolExecutor
483-
484486
pool = ThreadPoolExecutor(max_workers=4)
485487
for quiz in ac_items:
486488
pool.submit(self._download_code_by_quiz, quiz)

0 commit comments

Comments
 (0)