Watch2Gether API Documentation

Ok, I finally found the time to sit down and look at this issue again. For anyone facing the same issue with a 403 response I’ll post what I did here. In short, I switched from using the python Requests package to using the urllib package, which seems to have done the trick.

Everything above the ‘else’ statement is the same as I posted above so I’ll just skip that here. It might also be important to note that you need to import both ‘request’ and ‘parse’ from urllib. For some reason, however, I also had an issue importing ‘request’ from urllib so I just didn’t bother with it and imported the whole urllib package.

else:
    payload = {
            "w2g_api_key": watchTogether_api_key,
            "item_url": f"{url}"
    }

    # HTTP request using urllib
    data = urllib.parse.urlencode(payload).encode()
    req = urllib.request.Request(f"https://w2g.tv/rooms/{streamkey}/sync_update", data=data) # this will make the method "POST"
    resp = urllib.request.urlopen(req)
    print(resp.code)
1 Like