2 # -*- coding: utf-8 -*-
3 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
7 from poster.encode import multipart_encode
8 from poster.streaminghttp import register_openers
14 datagen, headers = multipart_encode({'book_xml_file': open(sys.argv[1], "rb")})
15 data = ''.join(list(datagen))
16 for key, value in headers.items():
17 headers[key] = str(value)
19 password = getpass.getpass()
22 h.add_credentials('zuber', password)
23 h.follow_all_redirects = True
25 resp, content = h.request(
26 'http://localhost:8000/api/books.json',