def force_update_db():
dbdir = '/var/tmp/supotato'
dbpath = '/var/tmp/supotato/supotato.db'
if os.path.exists(dbpath):
os.remove(dbpath)
if not os.path.exists(dbdir):
os.mkdir(dbdir)
import urllib.request
url = "https://everettjf.github.io/app/supotato/supotato.db"
print('CocoaPods Index Database not exist , will download from ' + url)
print('Please wait for a moment (about 5 MB file will be downloaded)')
# Download the file from `url` and save it locally under `file_name`:
with urllib.request.urlopen(url) as response, open(dbpath, 'wb') as out_file:
data = response.read() # a `bytes` object
out_file.write(data)
print('Download completed')
print('Update succeed')
评论列表
文章目录