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

SSL Error causing crash when fetching image sets. #1

Open
andrewtremblay opened this issue Feb 5, 2020 · 0 comments
Open

SSL Error causing crash when fetching image sets. #1

andrewtremblay opened this issue Feb 5, 2020 · 0 comments

Comments

@andrewtremblay
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant