Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pythonclient
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
charley.punshon
pythonclient
Commits
0cb2d7b8
Commit
0cb2d7b8
authored
May 07, 2021
by
charley.punshon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update main.py
parent
2c50ecb5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
8 deletions
+8
-8
main.py
main.py
+8
-8
No files found.
main.py
View file @
0cb2d7b8
...
@@ -12,7 +12,7 @@ scrollbar = Scrollbar(window, orient="vertical", command=canvasmain.yview)
...
@@ -12,7 +12,7 @@ scrollbar = Scrollbar(window, orient="vertical", command=canvasmain.yview)
authenticated
=
FALSE
authenticated
=
FALSE
def
login
():
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
()})
fields
=
{
'username'
:
username
.
get
(),
'password'
:
password
.
get
()})
if
loginr
.
status
==
200
:
if
loginr
.
status
==
200
:
canvastitle
.
delete
(
"all"
)
canvastitle
.
delete
(
"all"
)
...
@@ -72,7 +72,7 @@ def menu():
...
@@ -72,7 +72,7 @@ def menu():
def
getDogs
():
def
getDogs
():
t
=
urllib3
.
PoolManager
()
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
:
if
response
.
status
==
200
:
canvasmain
.
delete
(
"all"
)
canvasmain
.
delete
(
"all"
)
canvasmain
.
create_text
(
900
,
75
,
fill
=
"black"
,
font
=
"Arial 40 bold"
,
text
=
"Dog Breed Information"
)
canvasmain
.
create_text
(
900
,
75
,
fill
=
"black"
,
font
=
"Arial 40 bold"
,
text
=
"Dog Breed Information"
)
...
@@ -109,7 +109,7 @@ def getDogsForDelete():
...
@@ -109,7 +109,7 @@ def getDogsForDelete():
def
handler
():
def
handler
():
index
=
int
(
lb
.
curselection
()[
0
])
index
=
int
(
lb
.
curselection
()[
0
])
breed
=
lb
.
get
(
index
)
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
:
if
deleter
.
status
==
200
:
canvasmain
.
delete
(
"all"
)
canvasmain
.
delete
(
"all"
)
canvasmain
.
create_text
(
1000
,
400
,
fill
=
"black"
,
font
=
"Arial 10 bold"
,
canvasmain
.
create_text
(
1000
,
400
,
fill
=
"black"
,
font
=
"Arial 10 bold"
,
...
@@ -118,7 +118,7 @@ def getDogsForDelete():
...
@@ -118,7 +118,7 @@ def getDogsForDelete():
canvasmain
.
create_text
(
1000
,
400
,
fill
=
"black"
,
font
=
"Arial 10 bold"
,
canvasmain
.
create_text
(
1000
,
400
,
fill
=
"black"
,
font
=
"Arial 10 bold"
,
text
=
"Dog breed unable to be deleted please try again"
)
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
:
if
response
:
canvasmain
.
delete
(
"all"
)
canvasmain
.
delete
(
"all"
)
canvasmain
.
create_text
(
1000
,
75
,
fill
=
"black"
,
font
=
"Arial 35 bold"
,
text
=
"Delete Dog Breed from Our Database"
)
canvasmain
.
create_text
(
1000
,
75
,
fill
=
"black"
,
font
=
"Arial 35 bold"
,
text
=
"Delete Dog Breed from Our Database"
)
...
@@ -141,7 +141,7 @@ def addDogCanvasUpdate():
...
@@ -141,7 +141,7 @@ def addDogCanvasUpdate():
if
int
(
entry2
.
get
())
and
int
(
entry3
.
get
())
and
int
(
entry4
.
get
())
and
int
(
entry5
.
get
()):
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"
,
canvastitle
.
create_text
(
1000
,
230
,
fill
=
"black"
,
font
=
"Arial 10 bold"
,
text
=
"correct types"
)
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
(),
fields
=
{
'dogbreed'
:
entry1
.
get
(),
'exercise'
:
entry2
.
get
(),
'hours'
:
entry3
.
get
(),
'years'
:
entry4
.
get
(),
'growth'
:
entry5
.
get
(),
'image'
:
entry6
.
get
()})
'years'
:
entry4
.
get
(),
'growth'
:
entry5
.
get
(),
'image'
:
entry6
.
get
()})
if
adddog
.
status
==
200
:
if
adddog
.
status
==
200
:
...
@@ -189,7 +189,7 @@ def updateDogCanvasUpdate():
...
@@ -189,7 +189,7 @@ def updateDogCanvasUpdate():
def
handler
():
def
handler
():
index
=
int
(
lb
.
curselection
()[
0
])
index
=
int
(
lb
.
curselection
()[
0
])
breed
=
lb
.
get
(
index
)
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
()})
fields
=
{
'dogbreednospace'
:
breed
,
'dogimage'
:
updateurl
.
get
()})
if
updater
.
status
==
200
:
if
updater
.
status
==
200
:
canvasmain
.
delete
(
"all"
)
canvasmain
.
delete
(
"all"
)
...
@@ -201,7 +201,7 @@ def updateDogCanvasUpdate():
...
@@ -201,7 +201,7 @@ def updateDogCanvasUpdate():
canvasmain
.
delete
(
"all"
)
canvasmain
.
delete
(
"all"
)
canvasmain
.
create_text
(
1000
,
75
,
fill
=
"black"
,
font
=
"Arial 40 bold"
,
text
=
"Update Dog Breed From Database"
)
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
:
if
response
:
dogs
=
json
.
loads
(
response
.
data
)
dogs
=
json
.
loads
(
response
.
data
)
lb
=
Listbox
(
canvasmain
,
height
=
10
)
lb
=
Listbox
(
canvasmain
,
height
=
10
)
...
@@ -238,4 +238,4 @@ guestLoginBtn = Button(window, text="Login as Guest", command=guestclient)
...
@@ -238,4 +238,4 @@ guestLoginBtn = Button(window, text="Login as Guest", command=guestclient)
guestLoginBtn
.
pack
(
pady
=
10
)
guestLoginBtn
.
pack
(
pady
=
10
)
guestLoginBtn_window
=
canvastitle
.
create_window
(
445
,
220
,
anchor
=
NW
,
window
=
guestLoginBtn
)
guestLoginBtn_window
=
canvastitle
.
create_window
(
445
,
220
,
anchor
=
NW
,
window
=
guestLoginBtn
)
canvastitle
.
pack
(
pady
=
20
)
canvastitle
.
pack
(
pady
=
20
)
window
.
mainloop
()
window
.
mainloop
()
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment