X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/2f4641a37c242ce97fc3c42d93d80d7f24c442c3..02fe6525fe7fa7c16d6e1dfe0ca040ac07d41325:/scripts/test_api.py diff --git a/scripts/test_api.py b/scripts/test_api.py deleted file mode 100644 index c53cfd3d1..000000000 --- a/scripts/test_api.py +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. -# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. -# -import httplib2 -from poster.encode import multipart_encode -from poster.streaminghttp import register_openers -import sys -import getpass - -register_openers() - -datagen, headers = multipart_encode({'book_xml_file': open(sys.argv[1], "rb")}) -data = ''.join(list(datagen)) -for key, value in headers.items(): - headers[key] = str(value) - -password = getpass.getpass() - -h = httplib2.Http() -h.add_credentials('zuber', password) -h.follow_all_redirects = True - -resp, content = h.request( - 'http://localhost:8000/api/books.json', - 'POST', - body=data, - headers=headers -) -print resp, content \ No newline at end of file