def save_project_info(url, username, save_path): # Make GET request with basic authentication response = requests.get(url, auth=(username, '')) # Check if request was successful if response.status_code == 200: # Parse JSON response project_info = response.json() # Save project information to a new .txt file with open(save_path, 'w') as file: file.write(json.dumps(project_info, indent=4)) print("Project information saved successfully to:", save_path) else: project_info_fail = response.json() # Save project information to a new .txt file with open(save_path, 'w') as file: file.write(json.dumps(project_info_fail, indent=4)) print("Failed to retrieve project information. Status code:", response.status_code) if __name__ == "__main__": project_id = input("Enter the ProjectID/Name: ") url_path = "http://localhost:11200/public/api/projects/" final_url = url_path + project_id username = input("Enter the Username: ") save_path = input("Enter the local path to save the file: ") final_save_path = save_path + project_id + ".json" save_project_info(final_url, username, final_save_path)