Commit 0cb2d7b8 authored by charley.punshon's avatar charley.punshon

Update main.py

parent 2c50ecb5
......@@ -12,7 +12,7 @@ scrollbar = Scrollbar(window, orient="vertical", command=canvasmain.yview)
authenticated = FALSE
def login():
loginr = t.request('POST', 'http://cs2s.yorkdc.net:5002/loggedin',
loginr = t.request('POST', 'http://ysjcs.net:5002/loggedin',
fields={'username': username.get(), 'password': password.get()})
if loginr.status == 200:
canvastitle.delete("all")
......@@ -72,7 +72,7 @@ def menu():
def getDogs():
t = urllib3.PoolManager()
response = t.request('GET', "http://cs2s.yorkdc.net:5002/dogs")
response = t.request('GET', "http://ysjcs.net:5002/dogs")
if response.status == 200:
canvasmain.delete("all")
canvasmain.create_text(900, 75, fill="black", font="Arial 40 bold", text="Dog Breed Information")
......@@ -109,7 +109,7 @@ def getDogsForDelete():
def handler():
index = int(lb.curselection()[0])
breed = lb.get(index)
deleter = t.request('DELETE', "http://cs2s.yorkdc.net:5002/dogs/" + breed)
deleter = t.request('DELETE', "http://ysjcs.net:5002/dogs/" + breed)
if deleter.status == 200:
canvasmain.delete("all")
canvasmain.create_text(1000, 400, fill="black", font="Arial 10 bold",
......@@ -118,7 +118,7 @@ def getDogsForDelete():
canvasmain.create_text(1000, 400, fill="black", font="Arial 10 bold",
text="Dog breed unable to be deleted please try again")
response = t.request('GET', "http://cs2s.yorkdc.net:5002/dogs")
response = t.request('GET', "http://ysjcs.net:5002/dogs")
if response:
canvasmain.delete("all")
canvasmain.create_text(1000, 75, fill="black", font="Arial 35 bold", text="Delete Dog Breed from Our Database")
......@@ -141,7 +141,7 @@ def addDogCanvasUpdate():
if int(entry2.get()) and int(entry3.get()) and int(entry4.get()) and int(entry5.get()):
canvastitle.create_text(1000, 230, fill="black", font="Arial 10 bold",
text="correct types")
adddog = t.request('POST', 'http://cs2s.yorkdc.net:5002/senddogs',
adddog = t.request('POST', 'http://ysjcs.net:5002/senddogs',
fields={'dogbreed': entry1.get(), 'exercise': entry2.get(), 'hours': entry3.get(),
'years': entry4.get(), 'growth': entry5.get(), 'image': entry6.get()})
if adddog.status == 200:
......@@ -189,7 +189,7 @@ def updateDogCanvasUpdate():
def handler():
index = int(lb.curselection()[0])
breed = lb.get(index)
updater = t.request('PUT', 'http://cs2s.yorkdc.net:5002/updatedog',
updater = t.request('PUT', 'http://ysjcs.net:5002/updatedog',
fields={'dogbreednospace': breed, 'dogimage': updateurl.get()})
if updater.status == 200:
canvasmain.delete("all")
......@@ -201,7 +201,7 @@ def updateDogCanvasUpdate():
canvasmain.delete("all")
canvasmain.create_text(1000, 75, fill="black", font="Arial 40 bold", text="Update Dog Breed From Database")
response = t.request('GET', "http://cs2s.yorkdc.net:5002/dogs")
response = t.request('GET', "http://ysjcs.net:5002/dogs")
if response:
dogs = json.loads(response.data)
lb = Listbox(canvasmain, height=10)
......@@ -238,4 +238,4 @@ guestLoginBtn = Button(window, text="Login as Guest", command=guestclient)
guestLoginBtn.pack(pady=10)
guestLoginBtn_window = canvastitle.create_window(445, 220, anchor=NW, window=guestLoginBtn)
canvastitle.pack(pady=20)
window.mainloop()
\ No newline at end of file
window.mainloop()
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