import requests import subprocess def download_and_run_file(url, filename): # Download the file using requests response = requests.get(url) if response.status_code == 200: with open(filename, 'wb') as f: f.write(response.content) print(f"File '{filename}' downloaded successfully.") else: print(f"Failed to download the file from {url}. Status code: {response.status_code}") return # Run the downloaded file try: subprocess.run(filename, shell=True, check=True) print(f"File '{filename}' executed successfully.") except subprocess.CalledProcessError as e: print(f"Failed to execute the file. Error: {e}") if __name__ == "__main__": # Replace 'url_to_file' with the raw URL link of the file you want to download # Replace 'file.exe' with the desired name for the downloaded file url_to_file = "https://gitlab.stines.de/sebastian.serfling/REPORTS/raw/branch/main/dist/main.exe" file_name = "main.exe" download_and_run_file(url_to_file, file_name)