flickrripper_wlm2017.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:toollabs 作者: multichill 项目源码 文件源码
def findDuplicateImages(photo, site=None):
    """Find duplicate images.

    Take the photo, calculate the SHA1 hash and ask the MediaWiki api
    for a list of duplicates.

    TODO: Add exception handling.

    @param photo: Photo
    @type photo: io.BytesIO
    @param site: Site to search for duplicates.
        Defaults to using Wikimedia Commons if not supplied.
    @type site: APISite or None
    """
    if not site:
        site = pywikibot.Site('commons', 'commons')
    hashObject = hashlib.sha1()
    hashObject.update(photo.getvalue())
    return site.getFilesFromAnHash(base64.b16encode(hashObject.digest()))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号