2 from poster.encode import multipart_encode
3 from poster.streaminghttp import register_openers
9 datagen, headers = multipart_encode({'book_xml_file': open(sys.argv[1], "rb")})
10 data = ''.join(list(datagen))
11 for key, value in headers.items():
12 headers[key] = str(value)
14 password = getpass.getpass()
17 h.add_credentials('zuber', password)
18 h.follow_all_redirects = True
20 resp, content = h.request(
21 'http://localhost:8000/api/books.json',