def select(self, channel, password=None, **extra_params): url = self.url(USHER_SELECT_PATH, channel) params = dict(p=int(random() * 999999), type="any", allow_source="true", private_code=password or "null", **extra_params) req = requests.Request("GET", url, params=params) # prepare_request is only available in requests 2.0+ if hasattr(http, "prepare_request"): req = http.prepare_request(req) else: req = req.prepare() return req.url
def select(self, channel, password=None, **extra_params): url = self.url(USHER_SELECT_PATH, channel) params = dict(p=int(random() * 999999), type="any", allow_source="true", private_code=password or "null", **extra_params) req = requests.Request("GET", url, params=params) # prepare_request is only available in requests 2.0+ if hasattr(http, "prepare_request"): req = http.prepare_request(req) else: req = req.prepare() return req.url
def _create_url(self, endpoint, **extra_params): url = "http://usher.twitch.tv{0}".format(endpoint) params = { "player": "twitchweb", "p": int(random() * 999999), "type": "any", "allow_source": "true", "allow_audio_only": "true", } params.update(extra_params) req = requests.Request("GET", url, params=params) # prepare_request is only available in requests 2.0+ if hasattr(http, "prepare_request"): req = http.prepare_request(req) else: req = req.prepare() return req.url
def _create_url(self, endpoint, **extra_params): url = "http://usher.twitch.tv{0}".format(endpoint) params = { "player": "twitchweb", "p": int(random() * 999999), "type": "any", "allow_source": "true", "allow_audio_only": "true", } params.update(extra_params) req = requests.Request("GET", url, params=params) # prepare_request is only available in requests 2.0+ if hasattr(http, "prepare_request"): req = http.prepare_request(req) else: req = req.prepare() return req.url
def select(self, channel, password=None, **extra_params): url = self.url(USHER_SELECT_PATH, channel) params = { "private_code": password or "null", "player": "twitchweb", "p": int(random() * 999999), "type": "any", "allow_source": "true", "allow_audio_only": "true", } params.update(extra_params) req = requests.Request("GET", url, params=params) # prepare_request is only available in requests 2.0+ if hasattr(http, "prepare_request"): req = http.prepare_request(req) else: req = req.prepare() return req.url