![]() read () with open ( local_fullpath, "wb" ) as fw : fw. extractfile ( member_name ) db_content = fr. getnames () for member_name in all_member_names : if member_name. open ( mode = "r:gz", fileobj = fileobj, errorlevel = 1, # Thus all fatal errors are raised as OSError ) all_member_names = tar. content ) # We need seekability tar = tarfile. get ( url, stream = True ) fileobj = io. write ( "Downloading geoip file ' %s ' to ' %s '" % ( url, local_fullpath ) ) try : req = requests. rsplit ( "/", 1 ) local_fullpath = str ( data_path / db_name ) self. ![]() ![]() mkdir ( parents = True, exist_ok = True ) for db_name, url in DATABASE_URLS : _, local_filename = url. Import io import pathlib import tarfile import requests from nf import settings from import BaseCommand DATABASE_URLS = class Command ( BaseCommand ): help = "Update Maxmind GeoLite binary databases for Cities and Countries." def handle ( self, * args, ** options ): data_path = pathlib. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |