Python Twitch API - Streamer online

Hi I copied a code from the web, but it seems not to work.

It checks if a streamer is online

    import urllib.request
    import urllib.parse
    import json


    def main():
        streamer = [
            "nl_Kripp",
            "AdmiralBulldog"
        ]

        CLIENT_ID = "ClientIDfromtwitch"
        URL = "https://api.twitch.tv/kraken/streams/"
        resps = []
        online_streams = []

        for id in streamer:
            header = {"client-id": CLIENT_ID}
            req = urllib.request.Request(URL + id, headers=header)
            recv = urllib.request.urlopen(req)
            resps.append(json.loads(recv.read().decode("UTF-8")))

        for r in resps:
            print(r)


    if __name__ == '__main__':
        main()

I get the following error message: urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)>

That would suggest your SSL bundle you have installed locally is invalid or out of date and needs updating.

Or the server clock you are using is totally out of date.

hey Barry,

sorry i am really new to this.

I did not understand a single word, and even google does not answer me what you wrote haha

Can you please describe it again?

The python install you are using is broken/incomplete.

Googling your error returns this

With some suggestions on how to fix/bypass certification verification (you shouldn’t do that latter)

1 Like

Thanks bro it worked

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.