19 lines
526 B
Python
19 lines
526 B
Python
import requests
|
|
|
|
|
|
def fetch_and_safe_license(license: str):
|
|
url = f"https://choosealicense.com/licenses/{license.lower()}/"
|
|
response = requests.get(url)
|
|
license_text = response.text.split('<pre id="license-text">')[1].split("</pre>")[0]
|
|
|
|
with open(f"licenses/{license}.txt", "w") as file:
|
|
file.write(license_text)
|
|
|
|
print(f"License text saved to {license}.txt")
|
|
|
|
|
|
fetch_and_safe_license("MIT")
|
|
fetch_and_safe_license("GPL-3.0")
|
|
fetch_and_safe_license("AGPL-3.0")
|
|
fetch_and_safe_license("Unlicense")
|