<reponame>MayD524/MDrive<filename>src/client/client.py
import requests
import os

url = 'http://admin:SuperAdminPasssword6742344234!!@localhost:8080/'#'http://admin:SuperAdminPasssword6742344234!!@a18e-2601-182-ce00-c860-3c42-c8b2-be91-176.ngrok.io/'


#resp = requests.post(url, data={'newUser': True, 'username': 'new_user', 'password': '<PASSWORD>'})
## makefile : filename
## writefile : filename, data : str
## deletefile : filename
## readfile : filename (gotten from GET request)
## makefolder : foldername
## deletefolder : foldername
## listfolder : foldername
## changedir : foldername
## renamefile : filename, newname : str
## renamefolder : foldername, newname : str
##

"""requests.put(url, data={'deletefile': "4.png"})
img = Image.open('shitpost.png')
requests.post(url, data={'makefile': "4.png"})
resp = requests.put(url, data={"writefile": "4.png", "authToken": "<PASSWORD>", "username": "new_user", "data": img.tobytes()})

resp = requests.get(url + "4.png")

image = Image.frombytes('RGBA', img.size, resp.content)
img.save('4.png', format='PNG')"""

#req = requests.post(url, data={"makefile": "test2.txt"})
#print(req.content)

#req = requests.put(url, data={"writefile": "test2.txt", "authToken": "<PASSWORD>", "username": "admin_super_0", "data": "test helfgs<PASSWORD>glo world"})
#print(req.content)

req = requests.get(url + "test2.txt")
print(req.content)