1
'''Temporarily store a blob in Launchpad and get a ticket for it.
3
Copyright (C) 2007 Canonical Ltd.
4
Author: Martin Pitt <martin.pitt@ubuntu.com>
6
This program is free software; you can redistribute it and/or modify it
7
under the terms of the GNU General Public License as published by the
8
Free Software Foundation; either version 2 of the License, or (at your
9
option) any later version. See http://www.gnu.org/copyleft/gpl.html for
10
the full text of the license.
13
import MultipartPostHandler, urllib2
16
'''Upload given blob (file-like object) to Malone and return the ticket for
19
Return None on error.'''
23
opener = urllib2.build_opener(MultipartPostHandler.MultipartPostHandler)
24
result = opener.open('https://launchpad.net/+storeblob',
25
{ 'FORM_SUBMIT': '1', 'field.blob': blob })
26
ticket = result.info().get('X-Launchpad-Blob-Token')