From 2449fb96eedfb3ff113bb7ff6a3bdfb5343aa459 Mon Sep 17 00:00:00 2001 From: aldacron Date: Thu, 18 May 2017 01:03:30 -0700 Subject: [PATCH] added clarity to api_uploader --- utils/api_uploader.py | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/utils/api_uploader.py b/utils/api_uploader.py index e70946b..5b26bf5 100644 --- a/utils/api_uploader.py +++ b/utils/api_uploader.py @@ -5,24 +5,26 @@ import json import requests ''' -The POST payload to the api endpoint (/api/upload) should look like this -{ - 'auth_info': { - 'username': str, - 'password': str - }, - 'torrent_info': { - 'category': str, # see below - 'display_name': str, # optional - 'information': str, - 'description': str, - 'is_anonymous': boolean, - 'is_hidden': boolean, - 'is_remake': boolean, - 'is_complete': boolean - }, - 'torrent_file': bytes # see below example -} +The POST payload to the api endpoint (/api/upload) should be multipart/form-data containing three fields + +'auth_info': file containing "{ + 'username': str, + 'password': str +}", + +'torrent_info': { + 'category': str, # see below + 'display_name': str, # optional + 'information': str, + 'description': str, + 'is_anonymous': boolean, + 'is_hidden': boolean, + 'is_remake': boolean, + 'is_complete': boolean +}, + +'torrent_file': multi part file format + A successful request should return {'Success': int(torrent_id)} A failed request should return {'Failure': ["Failure 1", "Failure 2"...]]}