Skip to content

Commit 50222c4

Browse files
committed
Add spider_args to schedule method
1 parent 57a688e commit 50222c4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scrapinghub/client.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,13 @@ def schedule(self, spidername=None, **params):
457457
raise ValueError('Please provide spidername')
458458
params['project'] = self.projectid
459459
params['spider'] = spidername or self.spider.name
460+
spider_args = params.pop('spider_args', None)
461+
if spider_args:
462+
if not isinstance(spider_args, dict):
463+
raise ValueError("spider_args should be a dictionary")
464+
cleaned_args = {k: v for k, v in spider_args.items()
465+
if k not in params}
466+
params.update(cleaned_args)
460467
if 'job_settings' in params:
461468
params['job_settings'] = json.dumps(params['job_settings'])
462469
if 'meta' in params:

0 commit comments

Comments
 (0)