(self, game, platform='Windows', disable_https=False)
| 1237 | return manifest_urls, base_urls, manifest_hash |
| 1238 | |
| 1239 | def get_cdn_manifest(self, game, platform='Windows', disable_https=False): |
| 1240 | manifest_urls, base_urls, manifest_hash = self.get_cdn_urls(game, platform) |
| 1241 | if not manifest_urls: |
| 1242 | raise ValueError('No manifest URLs returned by API') |
| 1243 | |
| 1244 | if disable_https: |
| 1245 | manifest_urls = [url.replace('https://', 'http://') for url in manifest_urls] |
| 1246 | |
| 1247 | for url in manifest_urls: |
| 1248 | self.log.debug(f'Trying to download manifest from "{url}"...') |
| 1249 | try: |
| 1250 | r = self.egs.unauth_session.get(url, timeout=10.0) |
| 1251 | except Exception as e: |
| 1252 | self.log.warning(f'Unable to download manifest from "{urlparse(url).netloc}" ' |
| 1253 | f'(Exception: {e!r}), trying next URL...') |
| 1254 | continue |
| 1255 | |
| 1256 | if r.status_code == 200: |
| 1257 | manifest_bytes = r.content |
| 1258 | break |
| 1259 | else: |
| 1260 | self.log.warning(f'Unable to download manifest from "{urlparse(url).netloc}" ' |
| 1261 | f'(status: {r.status_code}), trying next URL...') |
| 1262 | else: |
| 1263 | raise ValueError(f'Unable to get manifest from any CDN URL, last result: {r.status_code} ({r.reason})') |
| 1264 | |
| 1265 | if sha1(manifest_bytes).hexdigest() != manifest_hash: |
| 1266 | raise ValueError('Manifest sha hash mismatch!') |
| 1267 | |
| 1268 | return manifest_bytes, base_urls |
| 1269 | |
| 1270 | def get_uri_manifest(self, uri): |
| 1271 | if uri.startswith('http'): |
no test coverage detected