Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,10 @@ from flask import Flask, jsonify
|
|
| 2 |
from flask_cors import CORS
|
| 3 |
import subprocess
|
| 4 |
import IP2Location
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
|
|
@@ -16,6 +20,11 @@ IPV6_BIN = "ipv6/IP2PROXY-LITE-PX2.BIN"
|
|
| 16 |
db_ipv4 = IP2Location.IP2Location(IPV4_BIN)
|
| 17 |
db_ipv6 = IP2Location.IP2Location(IPV6_BIN)
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
@app.route('/')
|
| 21 |
def home():
|
|
@@ -77,6 +86,11 @@ def check_ip():
|
|
| 77 |
})
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
|
| 81 |
@app.route('/get_latest_version', methods=['GET'])
|
| 82 |
def get_latest_version():
|
|
|
|
| 2 |
from flask_cors import CORS
|
| 3 |
import subprocess
|
| 4 |
import IP2Location
|
| 5 |
+
import zipfile
|
| 6 |
+
import os
|
| 7 |
+
import glob
|
| 8 |
+
|
| 9 |
|
| 10 |
|
| 11 |
|
|
|
|
| 20 |
db_ipv4 = IP2Location.IP2Location(IPV4_BIN)
|
| 21 |
db_ipv6 = IP2Location.IP2Location(IPV6_BIN)
|
| 22 |
|
| 23 |
+
zip_folder = "ipv4" # Change this to your folder
|
| 24 |
+
extract_to = "ipv4"
|
| 25 |
+
|
| 26 |
+
zip_files = glob.glob(os.path.join(zip_folder, "*.zip")) # Find all ZIPs
|
| 27 |
+
|
| 28 |
|
| 29 |
@app.route('/')
|
| 30 |
def home():
|
|
|
|
| 86 |
})
|
| 87 |
|
| 88 |
|
| 89 |
+
for zip_file in zip_files:
|
| 90 |
+
with zipfile.ZipFile(zip_file, 'r') as zip_ref:
|
| 91 |
+
zip_ref.extractall(extract_to)
|
| 92 |
+
print(f"✅ Extracted: {zip_file}")
|
| 93 |
+
|
| 94 |
|
| 95 |
@app.route('/get_latest_version', methods=['GET'])
|
| 96 |
def get_latest_version():
|