Ejemplo n.º 1
0
 def change_img(self, soup):
     img_tags = soup.find_all("img")
     img_arr = [img.attrs['src'] for img in img_tags if img['src']]
     resources = EvernoteMethod.getRemoteRes(img_arr)
     index = 0
     for img in img_tags:
         if img['src']:
             hexhash = binascii.hexlify(resources[index].data.bodyHash)
             new_tag = soup.new_tag('en-media')
             new_tag['type'] = resources[index].mime
             new_tag['hash'] = hexhash
             img.replace_with(new_tag)
             index += 1
     return resources