2020-10-15 13:34:34 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
|
|
import requests
|
|
|
|
|
from common.params import Params
|
|
|
|
|
import sys
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
if len(sys.argv) < 2:
|
2021-12-16 14:58:17 +01:00
|
|
|
print(f"{sys.argv[0]} <github username>")
|
2020-10-15 13:34:34 +02:00
|
|
|
exit(1)
|
|
|
|
|
|
|
|
|
|
username = sys.argv[1]
|
|
|
|
|
keys = requests.get(f"https://github.com/{username}.keys")
|
|
|
|
|
|
|
|
|
|
if keys.status_code == 200:
|
|
|
|
|
Params().put("GithubSshKeys", keys.text)
|
2021-05-25 15:45:29 -07:00
|
|
|
Params().put("GithubUsername", username)
|
2021-08-06 02:05:49 +07:00
|
|
|
print("Setup ssh keys successfully")
|
2020-10-15 13:34:34 +02:00
|
|
|
else:
|
|
|
|
|
print("Error getting public keys from github")
|