Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Try_except
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kranthi.kumar
Try_except
Commits
bfb4121d
Commit
bfb4121d
authored
Jan 19, 2021
by
kranthi.kumar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic Commit
parent
ea97df6c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
0 deletions
+41
-0
app.py
app.py
+11
-0
scripts/handler/colour_finder_handler.py
scripts/handler/colour_finder_handler.py
+12
-0
scripts/service/colour_finder_service.py
scripts/service/colour_finder_service.py
+18
-0
No files found.
app.py
0 → 100644
View file @
bfb4121d
from
flask
import
Flask
from
scripts.service.colour_finder_service
import
color_finder
app
=
Flask
(
__name__
)
app
.
register_blueprint
(
color_finder
)
try
:
if
__name__
==
'__main__'
:
app
.
run
(
port
=
8007
)
except
Exception
as
e
:
print
(
e
)
scripts/handler/colour_finder_handler.py
0 → 100644
View file @
bfb4121d
class
Find_Colour
:
@
staticmethod
def
find_colour
(
data
):
try
:
data_required
=
set
()
for
i_data_id
,
i_data_value
in
(
data
[
'settings'
][
'spc_settings'
]
.
items
()):
for
i_data2_value
in
i_data_value
[
"data"
]:
data_required
.
add
(
i_data2_value
[
"color"
])
data_required
=
list
(
data_required
)
return
{
"data"
:
data_required
}
except
Exception
:
raise
Exception
(
"list object does not have add attribute"
)
scripts/service/colour_finder_service.py
0 → 100644
View file @
bfb4121d
from
flask
import
Blueprint
from
flask
import
request
import
logging
from
scripts.handler.colour_finder_handler
import
Find_Colour
color_finder
=
Blueprint
(
'example_blueprint'
,
__name__
)
find_colour_object
=
Find_Colour
()
try
:
@
color_finder
.
route
(
'/host'
,
methods
=
[
'POST'
])
def
post_request
():
content
=
request
.
get_json
()
required_data
=
find_colour_object
.
find_colour
(
content
)
return
required_data
except
Exception
:
logging
.
info
(
"find colour method is not working"
)
raise
Exception
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