示例#1
0
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
示例#2
0
 def __init__(self, img):
     self.img = os.path.abspath(img)
     self.img = os.path.expanduser(img)
     self.req = Req(nline=4, nchar=34)