Skip to content
This repository was archived by the owner on Jun 12, 2022. It is now read-only.
This repository was archived by the owner on Jun 12, 2022. It is now read-only.

SSL Error causing crash when fetching image sets.  #1

@andrewtremblay

Description

@andrewtremblay

To fix, I've adjusted fetchSetImages.py

import os
+ import ssl

+ context = ssl._create_unverified_context()

def fetchSetImages(setcode):
    if (setcode+'.images') not in files: # if .images file doesnt exist
        print(setcode +'.images','file not found, generating from gatherer now')
        set = cardset(setcode)# call card_set_json to get image URLs
        for i in range(len(set.uids)):# fetch all card images from URLs
            url = set.imgurls[i]
            if (url != None):
+                url_response = urlreq.urlopen(url, context=context)
                img_array = np.array(bytearray(url_response.read()), dtype=np.uint8)
                img = cv2.imdecode(img_array, -1)
                imgdict[set.uids[i]] = img
                print(i)
                

Ideally we would need to securely download the images from the https urls, but I'm not sure if that's the responsibility of this repo or MTG json not providing the correct URL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions