no need to overwrite save_url anymore

This commit is contained in:
j 2024-04-19 09:22:37 +02:00
parent f96815c175
commit 86e7d12eff

16
edit.py
View file

@ -20,20 +20,6 @@ pandora_client_config = {}
use_local = False 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'): if os.path.exists('files.json'):
files = json.load(open('files.json')) files = json.load(open('files.json'))
@ -192,7 +178,7 @@ if __name__ == '__main__':
credentials['password'] = getpass.getpass('Password: ') credentials['password'] = getpass.getpass('Password: ')
update = True update = True
api = API(base_url + '/api/') api = ox.API(base_url + '/api/')
r = api.signin(**credentials) r = api.signin(**credentials)
if 'errors' in r.get('data', {}): if 'errors' in r.get('data', {}):
for kv in r['data']['errors'].items(): for kv in r['data']['errors'].items():