Spaces:
Build error
Build error
| import requests | |
| headers = { | |
| "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36" | |
| } | |
| def read_from_url(file_path): | |
| if file_path.startswith("http"): | |
| tmp_path = f'/tmp/clamd_{file_path.split("/")[-1].split("?")[0]}' | |
| print("tmp_path ", tmp_path) | |
| resp = requests.get(file_path, headers=headers).content | |
| with open(tmp_path, "wb") as f: | |
| f.write(resp) | |
| return tmp_path | |
| return file_path | |