berdav / greenpass

Scriptable green pass / Digital Covid Certificate verifier.
GNU Lesser General Public License v3.0
53 stars 21 forks source link

when TESTS_URL is down or redirect bypass the request #23

Closed verbavolant closed 3 years ago

verbavolant commented 3 years ago

Hi in greenpass/data.py when TESTS_URL is down or under maintenance (as now) the script hangs.

I've added the 302 http response

def get_tests_pn(self):
    o = {}
    r = requests.get(TESTS_URL)
    if r.status_code != 200:
        return o
    if r.status_code != 302:
        return o
    l = json.loads(r.text)       
berdav commented 3 years ago

You're right, I've just added a try catch for another problem because the TESTS_URL is under maintenance.

Your fix seems broken to me if the system returns 200 then, so I will just follow the redirects using requests.

Should be fixed in the current master, I will reopen if it is not.