commit 5aa900eacda966a33cd998876b5bc2d35076628a Author: chubby Date: Thu Sep 14 23:17:36 2023 +0300 first commit 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)