Skip to content

Commit

Permalink
new store db separation
Browse files Browse the repository at this point in the history
  • Loading branch information
joamag committed Jan 6, 2016
1 parent ae22cb5 commit c4b8463
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/netius/common/geo.py
Expand Up @@ -91,14 +91,18 @@ def _get_db(cls):

@classmethod
def _download_db(cls, path = DB_NAME):
path_gz = path + ".gz"
result = netius.clients.HTTPClient.method_s(
"GET",
cls.DOWNLOAD_URL,
async = False
)
response = netius.clients.HTTPClient.to_response(result)
contents = response.read()
cls._store_db(contents, path = path)

@classmethod
def _store_db(cls, contents, path = DB_NAME):
path_gz = path + ".gz"
file = open(path_gz, "wb")
try: file.write(contents)
finally: file.close()
Expand Down

0 comments on commit c4b8463

Please sign in to comment.