mirror of https://github.com/CIRCL/AIL-framework
chg: [crawlers] submit cookies to the crawler task API
parent
ed0423118e
commit
68c17c3fbc
|
@ -1692,17 +1692,18 @@ def api_add_crawler_task(data, user_id=None):
|
||||||
return {'error': 'The access to this cookiejar is restricted'}, 403
|
return {'error': 'The access to this cookiejar is restricted'}, 403
|
||||||
cookiejar_uuid = cookiejar.uuid
|
cookiejar_uuid = cookiejar.uuid
|
||||||
|
|
||||||
cookie = data.get('cookie', None)
|
cookies = data.get('cookies', None)
|
||||||
if not cookiejar_uuid and cookie:
|
if not cookiejar_uuid and cookies:
|
||||||
# Create new cookiejar
|
# Create new cookiejar
|
||||||
cookiejar_uuid = create_cookiejar(user_id, "single-shot cookiejar", 1, None)
|
cookiejar_uuid = create_cookiejar(user_id, "single-shot cookiejar", 1, None)
|
||||||
cookiejar = Cookiejar(cookiejar_uuid)
|
cookiejar = Cookiejar(cookiejar_uuid)
|
||||||
try:
|
for cookie in cookies:
|
||||||
name = cookie.get('name')
|
try:
|
||||||
value = cookie.get('value')
|
name = cookie.get('name')
|
||||||
cookiejar.add_cookie(name, value, None, None, None, None, None)
|
value = cookie.get('value')
|
||||||
except KeyError:
|
cookiejar.add_cookie(name, value, None, None, None, None, None)
|
||||||
return {'error': 'Invalid cookie key, please submit a valid JSON', 'cookiejar_uuid': cookiejar_uuid}, 400
|
except KeyError:
|
||||||
|
return {'error': 'Invalid cookie key, please submit a valid JSON', 'cookiejar_uuid': cookiejar_uuid}, 400
|
||||||
|
|
||||||
frequency = data.get('frequency', None)
|
frequency = data.get('frequency', None)
|
||||||
if frequency:
|
if frequency:
|
||||||
|
|
Loading…
Reference in New Issue