class ImgBed(object): def __init__(self, img): self.img = os.path.abspath(img) self.img = os.path.expanduser(img) self.req = Req(nline=4, nchar=34) def upload(self): header = { 'Host':'www.freeimagehosting.net', 'Origin':'http://www.freeimagehosting.net', 'Referer':'http://www.freeimagehosting.net/upload.php', } kw = (('attached',[self.img])) jmp = self.req.post_multipart(URL['upload'],header,kw) link = PARSE_SHARE_LINK.findall(jmp.read())[0] logger.logit('post %s to %s'%(self.img,link)) #log return link
def __init__(self, img): self.img = os.path.abspath(img) self.img = os.path.expanduser(img) self.req = Req(nline=4, nchar=34)