Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
Webservice Marcimex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Luis Acosta
Webservice Marcimex
Commits
61e8bc2b
Commit
61e8bc2b
authored
Dec 24, 2024
by
Luis Acosta
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Version 1.0.3
parent
61dd0635
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
+4
-4
app.py
app.py
+4
-4
No files found.
app.py
View file @
61e8bc2b
...
@@ -44,7 +44,7 @@ def login():
...
@@ -44,7 +44,7 @@ def login():
datos
=
request
.
json
datos
=
request
.
json
usuario
=
datos
.
get
(
"usuario"
)
usuario
=
datos
.
get
(
"usuario"
)
contrasena
=
datos
.
get
(
"contrasena"
)
contrasena
=
datos
.
get
(
"contrasena"
)
db
=
MySQLDatabase
(
host
=
db_host
,
user
=
db_user
,
password
=
""
,
database
=
db_name_hiper_service
)
db
=
MySQLDatabase
(
host
=
db_host
,
user
=
db_user
,
password
=
db_pass
,
database
=
db_name_hiper_service
)
resultado
=
db
.
consultar
(
"SELECT * FROM hiper_service_usuarios WHERE users =
%
s AND password =
%
s"
,(
f
'{usuario}'
,
f
'{contrasena}'
))
resultado
=
db
.
consultar
(
"SELECT * FROM hiper_service_usuarios WHERE users =
%
s AND password =
%
s"
,(
f
'{usuario}'
,
f
'{contrasena}'
))
if
resultado
:
if
resultado
:
access_token
=
create_access_token
(
identity
=
usuario
)
access_token
=
create_access_token
(
identity
=
usuario
)
...
@@ -64,7 +64,7 @@ def login():
...
@@ -64,7 +64,7 @@ def login():
@
jwt_required
()
@
jwt_required
()
def
Generate_Campaign
():
def
Generate_Campaign
():
usuario
=
get_jwt_identity
()
usuario
=
get_jwt_identity
()
db
=
MySQLDatabase
(
host
=
db_host
,
user
=
db_user
,
password
=
""
,
database
=
db_name_hiper_service
)
db
=
MySQLDatabase
(
host
=
db_host
,
user
=
db_user
,
password
=
db_pass
,
database
=
db_name_hiper_service
)
nuevo_id
=
db
.
insertar
(
"INSERT INTO hiper_service_accesos (usuario, token ,fecha_hora, status, message) VALUES (
%
s,
%
s,
%
s,
%
s,
%
s)"
,(
f
'{usuario}'
,
''
,
f
'{fecha_hora}'
,
'Generate Campaing'
,
'Access'
))
nuevo_id
=
db
.
insertar
(
"INSERT INTO hiper_service_accesos (usuario, token ,fecha_hora, status, message) VALUES (
%
s,
%
s,
%
s,
%
s,
%
s)"
,(
f
'{usuario}'
,
''
,
f
'{fecha_hora}'
,
'Generate Campaing'
,
'Access'
))
db
.
cerrar
()
db
.
cerrar
()
request_data
=
request
.
get_json
()
request_data
=
request
.
get_json
()
...
@@ -133,7 +133,7 @@ def Generate_Campaign():
...
@@ -133,7 +133,7 @@ def Generate_Campaign():
return
jsonify
({
"mensaje"
:
f
"Error al generar Campaing , {campaign_name}! Formato Invalido Data"
}),
401
return
jsonify
({
"mensaje"
:
f
"Error al generar Campaing , {campaign_name}! Formato Invalido Data"
}),
401
#Fin de validaciones
#Fin de validaciones
#Buscar el nombre de la campaña en la base de datos y tomar el valor del ID
#Buscar el nombre de la campaña en la base de datos y tomar el valor del ID
db_cc
=
MySQLDatabase
(
host
=
db_host
,
user
=
db_user
,
password
=
""
,
database
=
db_call_center
)
db_cc
=
MySQLDatabase
(
host
=
db_host
,
user
=
db_user
,
password
=
db_pass
,
database
=
db_call_center
)
resultado_campaign
=
db_cc
.
consultar
(
"SELECT * FROM campaign WHERE name =
%
s limit 1"
,(
f
'{camp_name}'
,))
resultado_campaign
=
db_cc
.
consultar
(
"SELECT * FROM campaign WHERE name =
%
s limit 1"
,(
f
'{camp_name}'
,))
if
resultado_campaign
:
if
resultado_campaign
:
for
registro
in
resultado_campaign
:
for
registro
in
resultado_campaign
:
...
@@ -181,7 +181,7 @@ def Generate_Campaign():
...
@@ -181,7 +181,7 @@ def Generate_Campaign():
@
jwt_required
()
@
jwt_required
()
def
Consult_Campaign
():
def
Consult_Campaign
():
usuario
=
get_jwt_identity
()
usuario
=
get_jwt_identity
()
db
=
MySQLDatabase
(
host
=
db_host
,
user
=
db_user
,
password
=
""
,
database
=
db_name_hiper_service
)
db
=
MySQLDatabase
(
host
=
db_host
,
user
=
db_user
,
password
=
db_pass
,
database
=
db_name_hiper_service
)
nuevo_id
=
db
.
insertar
(
"INSERT INTO hiper_service_accesos (usuario, token ,fecha_hora, status, message) VALUES (
%
s,
%
s,
%
s,
%
s,
%
s)"
,(
f
'{usuario}'
,
''
,
f
'{fecha_hora}'
,
'Consult Campaing'
,
'Access'
))
nuevo_id
=
db
.
insertar
(
"INSERT INTO hiper_service_accesos (usuario, token ,fecha_hora, status, message) VALUES (
%
s,
%
s,
%
s,
%
s,
%
s)"
,(
f
'{usuario}'
,
''
,
f
'{fecha_hora}'
,
'Consult Campaing'
,
'Access'
))
db
.
cerrar
()
db
.
cerrar
()
request_data
=
request
.
get_json
()
request_data
=
request
.
get_json
()
...
...
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