mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 23:42:37 +03:00
Merge branch 'some-compatibility-fixes' of https://gitlab.com/eighthave/fdroidserver
This commit is contained in:
commit
b4d768b225
5 changed files with 35 additions and 9 deletions
|
@ -22,6 +22,7 @@ import sys
|
|||
import re
|
||||
import shutil
|
||||
import glob
|
||||
import requests
|
||||
import stat
|
||||
import subprocess
|
||||
import time
|
||||
|
@ -70,8 +71,8 @@ default_config = {
|
|||
'keystore': 'keystore.jks',
|
||||
'smartcardoptions': [],
|
||||
'char_limits': {
|
||||
'Summary': 50,
|
||||
'Description': 1500
|
||||
'Summary': 80,
|
||||
'Description': 4000
|
||||
},
|
||||
'keyaliases': {},
|
||||
'repo_url': "https://MyFirstFDroidRepo.org/fdroid/repo",
|
||||
|
@ -2072,3 +2073,17 @@ def string_is_integer(string):
|
|||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
|
||||
def download_file(url, local_filename=None, dldir='tmp'):
|
||||
filename = url.split('/')[-1]
|
||||
if local_filename is None:
|
||||
local_filename = os.path.join(dldir, filename)
|
||||
# the stream=True parameter keeps memory usage low
|
||||
r = requests.get(url, stream=True)
|
||||
with open(local_filename, 'wb') as f:
|
||||
for chunk in r.iter_content(chunk_size=1024):
|
||||
if chunk: # filter out keep-alive new chunks
|
||||
f.write(chunk)
|
||||
f.flush()
|
||||
return local_filename
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue