From d079667f09d453b86d3d740ed042cdd03dc7fd3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ruair=C3=AD=20=C3=93=20Fathaigh?= Date: Tue, 5 Jun 2018 13:54:39 +0100 Subject: [PATCH] Read ScrapydDeploy schedule data from `_schedule_data` method --- portia_server/portia_api/utils/deploy/scrapyd.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/portia_server/portia_api/utils/deploy/scrapyd.py b/portia_server/portia_api/utils/deploy/scrapyd.py index 19ad8db04..2c30a5e04 100644 --- a/portia_server/portia_api/utils/deploy/scrapyd.py +++ b/portia_server/portia_api/utils/deploy/scrapyd.py @@ -51,7 +51,9 @@ def deploy(self, target='default'): 'project': cfg['project'], 'version': cfg['version'], } - files = [('project.egg', self.build_archive())] + files = { + 'egg': ('project.egg', self.build_archive()) + } url = urljoin(cfg['url'], '/addversion.json') user = cfg.get('username') if user: @@ -64,15 +66,15 @@ def deploy(self, target='default'): } def schedule(self, spider, args=None, settings=None, target=None): - schedule_data = self._schedule_data(spider, self.data) + schedule_data = self._schedule_data( + spider, self._schedule_data(spider, args)) request = requests.post( - urljoin(app_settings.SCRAPYD_URL, '/schedule.json', - data=schedule_data)) + urljoin(app_settings.SCRAPYD_URL, 'schedule.json'), + data=schedule_data) if request.status_code != 200: raise JsonApiGeneralException( request.status_code, request.content) - response = self.retrieve() - data = response.data + data = {} data.setdefault('meta', {})['scheduled'] = True return data