Skip to content

Commit

Permalink
fixed rate limiting
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan McInerney committed Nov 10, 2014
1 parent c559d48 commit ce6587f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions xsscrapy.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,15 @@ def get_args():

def main():
args = get_args()
rate = args.rate
if rate is not None:
delay = str(60 / float(rate))
rate = args.ratelimit
if rate not in [None, '0']:
rate = str(60 / float(rate))
try:
execute(['scrapy', 'crawl', 'xsscrapy',
'-a', 'url=%s' % args.url, '-a', 'user=%s' % args.login, '-a',
'pw=%s' % args.password, '-a', 'basic=%s' % args.basic, '-s',
'CONCURRENT_REQUESTS=%s' % args.connections,
'DOWNLOAD_DELAY=%s' % rate]
])
'pw=%s' % args.password, '-a', 'basic=%s' % args.basic,
'-s', 'CONCURRENT_REQUESTS=%s' % args.connections,
'-s', 'DOWNLOAD_DELAY=%s' % rate])
except KeyboardInterrupt:
sys.exit()

Expand Down

0 comments on commit ce6587f

Please sign in to comment.