From 86e7d12eff0585e3a58ef6a230999a212918554b Mon Sep 17 00:00:00 2001 From: j Date: Fri, 19 Apr 2024 09:22:37 +0200 Subject: [PATCH] no need to overwrite save_url anymore --- edit.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/edit.py b/edit.py index 516c8f1..4ff33a4 100755 --- a/edit.py +++ b/edit.py @@ -20,20 +20,6 @@ pandora_client_config = {} use_local = False -class API(ox.API): - - def save_url(self, url, filename, overwrite=False): - if not os.path.exists(filename) or overwrite: - dirname = os.path.dirname(filename) - if dirname and not os.path.exists(dirname): - os.makedirs(dirname) - chunk_size = 16 * 1024 - request = urllib.request.Request(url) - remote = self._opener.open(request) - with open(filename, 'wb') as f: - for chunk in iter(lambda: remote.read(chunk_size), b''): - f.write(chunk) - if os.path.exists('files.json'): files = json.load(open('files.json')) @@ -192,7 +178,7 @@ if __name__ == '__main__': credentials['password'] = getpass.getpass('Password: ') update = True - api = API(base_url + '/api/') + api = ox.API(base_url + '/api/') r = api.signin(**credentials) if 'errors' in r.get('data', {}): for kv in r['data']['errors'].items():