Exemplo n.º 1
0
    def _handleError(self, e, url, **kwargs):
        if e.__class__.__name__ == "ValueError":
            Script.log("Can not parse response of request url %s" %
                       url, lvl=Script.INFO)
            Script.notify("Internal Error", "")
        elif e.__class__.__name__ == "HTTPError":
            if e.code == 402:
                Script.notify("Subscription Error",
                              "You don't have valid subscription to watch this content")
            elif e.code == 401:
                status = self._refreshToken()
                if(status is True):
                    return self.get(url, **kwargs)
                else:
                    Script.notify("Token Error", str(status))

            elif e.code == 474 or e.code == 475:
                Script.notify(
                    "VPN Error", "Your VPN provider does not support Hotstar")
            else:
                raise urlquick.HTTPError(e.filename, e.code, e.msg, e.hdrs)
        else:
            Script.log("Got unexpected response for request url %s" %
                       url, lvl=Script.INFO)
            Script.notify(
                "API Error", "Raise issue if you are continuously facing this error")
Exemplo n.º 2
0
 def _handleError(self, e, url, **kwargs):
     if e.__class__.__name__ == "ValueError":
         Script.log("Can not parse response of request url %s" % url,
                    lvl=Script.INFO)
         Script.notify("Internal Error", "")
     elif e.__class__.__name__ == "HTTPError":
         raise urlquick.HTTPError(e.filename, e.code, e.msg, e.hdrs)
     else:
         Script.log("Got unexpected response for request url %s" % url,
                    lvl=Script.INFO)
         Script.notify(
             "API Error",
             "Raise issue if you are continuously facing this error")
Exemplo n.º 3
0
 def _handleError(self, e, url, **kwargs):
     if e.__class__.__name__ == "ValueError":
         Script.log("Can not parse response of request url %s" % url,
                    lvl=Script.DEBUG)
         Script.notify("Internal Error", "")
     elif e.__class__.__name__ == "HTTPError":
         if e.code == 419:
             executebuiltin(
                 "RunPlugin(plugin://plugin.video.jiotvplus/resources/lib/main/login/)"
             )
         else:
             raise urlquick.HTTPError(e.filename, e.code, e.msg, e.hdrs)
     else:
         Script.log("Got unexpected response for request url %s" % url,
                    lvl=Script.DEBUG)
         Script.notify(
             "API Error",
             "Raise issue if you are continuously facing this error")
Exemplo n.º 4
0
    def _handleError(self, e, url, _rtype, **kwargs):
        if e.__class__.__name__ == "ValueError":
            Script.log("Can not parse response of request url %s" % url,
                       lvl=Script.DEBUG)
            Script.notify("Internal Error", "")
        elif e.__class__.__name__ == "HTTPError":
            if e.code == 402 or e.code == 403:
                with PersistentDict("userdata.pickle") as db:
                    if db.get("isGuest"):
                        Script.notify("Login Error",
                                      "Please login to watch this content")
                        executebuiltin(
                            "RunPlugin(plugin://plugin.video.botallen.hotstar/resources/lib/main/login/)"
                        )
                    else:
                        Script.notify(
                            "Subscription Error",
                            "You don't have valid subscription to watch this content"
                        )
            elif e.code == 401:
                new_token = self._refreshToken()
                if new_token:
                    kwargs.get("headers") and kwargs['headers'].update(
                        {"X-HS-UserToken": new_token})
                    if _rtype == "get":
                        return self.get(url, **kwargs)
                    else:
                        return self.post(url, **kwargs)
                else:
                    Script.notify("Token Error", "Token not found")

            elif e.code == 474 or e.code == 475:
                Script.notify("VPN Error",
                              "Your VPN provider does not support Hotstar")
            else:
                raise urlquick.HTTPError(e.filename, e.code, e.msg, e.hdrs)
            return False
        else:
            Script.log("Got unexpected response for request url %s" % url,
                       lvl=Script.DEBUG)
            Script.notify(
                "API Error",
                "Raise issue if you are continuously facing this error")