first commit

This commit is contained in:
chubby 2023-09-14 23:17:36 +03:00
commit 5aa900eacd

18
main.py Normal file
View File

@ -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)