Skip to content

Commit

Permalink
Read ScrapydDeploy schedule data from _schedule_data method
Browse files Browse the repository at this point in the history
  • Loading branch information
ruairif committed Jun 5, 2018
1 parent 24bdb44 commit d079667
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions portia_server/portia_api/utils/deploy/scrapyd.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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

Expand Down

0 comments on commit d079667

Please sign in to comment.