def archives(self): if self.version is not None: try: response = requests.get(self.URL + 'LATEST_RELEASE') except requests.RequestException: return [] if response.status_code != 200: return [] version = Version.from_string(response.text.rstrip()) else: version = self.version os_name = platform.system() if os_name == 'Linux': os = 'linux{}'.format('64' if platform.machine()[-2:] == '64' else '') elif os_name == 'Darwin': os = 'mac64' else: return [] return [ Package.Archive( self.name, link='{}{}/chromedriver_{}.zip'.format(self.URL, version, os), version=version, extension='zip', ) ]
def archives(self): try: response = requests.get(self.URL) except requests.RequestException: return [] if response.status_code != 200: return [] os_name = platform.system() if os_name == 'Darwin': os = 'macos' else: os = '{}{}'.format(os_name, platform.machine()[-2:]) archives = [] for candidate in reversed(response.json()): try: version = Version.from_string(candidate.get('tag_name').split('v')[-1]) except ValueError: continue for asset in candidate.get('assets', []): url = asset.get('browser_download_url') if not url: continue if os not in url: continue extension = 'zip' if url.endswith('.zip') else 'tar.gz' if not url.endswith(extension): continue if self.version and version not in self.version: continue archives.append( Package.Archive( self.name, link=url, version=version, extension=extension, ) ) return archives