Skip to content

Commit 312c026

Browse files
committed
Minor Code change
Signed-off-by: Victor Otieno Omondi <vickz84259@gmail.com>
1 parent e686faf commit 312c026

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

scripts/download_xkcd.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
# download_xkcd.py - Downloads comics from xkcd.com.
44

55
__author__ = 'Victor Otieno Omondi'
6-
__version__ = '2.0.1-alpha'
6+
__version__ = '2.1.1-alpha'
77

88
# Standard library modules
99
import logging
1010
import Queue
11+
import time
1112

1213
# Third-Party modules
1314
import requests
@@ -16,8 +17,8 @@
1617
import argument
1718
import workers
1819

19-
url_workers = 4
20-
download_workers = 6
20+
url_workers = 10
21+
download_workers = 8
2122

2223
url_queue = Queue.Queue()
2324
download_queue = Queue.Queue()
@@ -69,7 +70,8 @@ def main():
6970

7071
except Exception, e:
7172
logger.exception('There was a problem: {}'.format(str(e)))
72-
print 'Error logged.'
73+
print e
74+
print 'Error logged'
7375

7476

7577
def download_comic(path, start=1, end=0):
@@ -99,6 +101,8 @@ def download_comic(path, start=1, end=0):
99101
for i in range(start, end):
100102
url_queue.put('http://xkcd.com/{}/info.0.json'.format(i))
101103

104+
time.sleep(5)
105+
102106
for i in range(download_workers):
103107
t = workers.DownloadWorker(path, download_queue)
104108
t.setDaemon(True)

0 commit comments

Comments
 (0)