From 5aa900eacda966a33cd998876b5bc2d35076628a Mon Sep 17 00:00:00 2001 From: chubby Date: Thu, 14 Sep 2023 23:17:36 +0300 Subject: [PATCH] first commit --- main.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..cd26d59 --- /dev/null +++ b/main.py @@ -0,0 +1,18 @@ +import requests +import json +import base64 +from requests.auth import HTTPBasicAuth +auth = HTTPBasicAuth('chubby', '81Iexqpxe!') +body = { + "name": "TEST2", +} +get_repos = requests.get("https://git.omg.team/api/v1/repos/chubby/TEST2", auth=auth) + +if get_repos.status_code==404: + + repository = requests.post("https://git.omg.team/api/v1/user/repos", auth=auth, json=body) + assert repository.status_code==201 + +file_cont = base64.b64encode(b'tra-ta-ta-ta-ta') +body = {"content":file_cont.decode('ascii')} +file = requests.post("https://git.omg.team/api/v1/repos/chubby/TEST2/contents/test.txt", auth=auth, json=body)