yoniif commited on
Commit
fadc020
·
verified ·
1 Parent(s): 527e812

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -16,7 +16,13 @@ zip_path = "top_100_influencers.zip"
16
  # Download zip file if not already present
17
  if not os.path.exists(zip_path):
18
  print("📥 Downloading influencer dataset...")
19
- r = requests.get(url)
 
 
 
 
 
 
20
  with open(zip_path, "wb") as f:
21
  f.write(r.content)
22
 
 
16
  # Download zip file if not already present
17
  if not os.path.exists(zip_path):
18
  print("📥 Downloading influencer dataset...")
19
+ headers = {"User-Agent": "Mozilla/5.0"}
20
+ r = requests.get(url, headers=headers)
21
+
22
+ # Confirm file is binary ZIP
23
+ if r.status_code != 200 or b"PK" not in r.content[:10]:
24
+ raise ValueError("❌ Invalid ZIP file downloaded. Check URL or access permissions.")
25
+
26
  with open(zip_path, "wb") as f:
27
  f.write(r.content)
28