Commit 1b5b0ea4 authored by Robin Fischer's avatar Robin Fischer

Add correct request and parameters

parent 2a9e04d2
......@@ -3,11 +3,32 @@
import sys
import os
import requests
import argparse
parser = argparse.ArgumentParser()
url = 'https://gitlab.com/api/v4/projects/2108455/pages/domains'
parser.add_argument("domain", help="Specify the domain which should be set")
parser.add_argument("projectId", help="The id of the gitlab probject to update")
parser.add_argument("publicKeyFile")
parser.add_argument("privateKeyFile")
args = parser.parse_args()
with open(args.publicKeyFile, "r") as file:
publicKey = file.read()
with open(args.privateKeyFile, "r") as file:
privateKey = file.read()
url = "https://gitlab.com/api/v4/projects/" + args.projectId + "/pages/domains/" + args.domain
headers = {"PRIVATE-TOKEN": os.environ["PRIVATE_TOKEN"]}
r = requests.get(url, headers=headers)
payload = { "certificate": publicKey, "key": privateKey }
r = requests.put(url, headers=headers, data=payload)
print(r.text.strip())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment