Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Luciano Barletta
/
Pruebas-RTO
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
Commit ba6a9b31
authored
2024-07-26 13:32:57 -0300
by
Tu Nombre
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Prueba de buscador
1 parent
d8e46e30
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
272 additions
and
0 deletions
configuracion.py
main.py
protected_static/buscador.js
pruebas.py
templates/buscador.html
configuracion.py
View file @
ba6a9b3
########Complat
carpetaDescargas
=
"/home/taller_5/Descargas/"
cabezaeraDescargas
=
"Planilla_Diaria-"
grepfile
=
"/home/taller_5/Pruebas-RTO/grep.sh"
...
...
main.py
View file @
ba6a9b3
...
...
@@ -8,6 +8,10 @@ from matematika import *
from
titulos
import
*
import
pruebas
class
MyCustomException
(
Exception
):
def
__init__
(
self
,
message
):
super
()
.
__init__
(
message
)
ing
=
ingenieros
.
ingenieros
()
FozaDiaria
=
fosadiaria
.
FosaDiaria
()
...
...
@@ -71,6 +75,17 @@ def historico():
bypass
=
False
)
@app.route
(
'/buscador'
)
def
buscador
():
if
"login"
not
in
request
.
cookies
:
return
redirect
(
url_for
(
"login"
))
return
render_template
(
"buscador.html"
,
bypass
=
False
)
@app.route
(
'/login'
,
methods
=
[
'GET'
,
'POST'
])
def
login
():
if
request
.
method
==
"GET"
:
...
...
@@ -79,6 +94,25 @@ def login():
)
else
:
try
:
user
=
request
.
json
[
'usuario'
]
pasw
=
request
.
json
[
'contrasena'
]
print
(
user
,
pasw
,
pruebas
.
login
)
if
pruebas
.
login
[
user
]
!=
pasw
:
raise
MyCustomException
(
"Ocurrió un error personalizado."
)
print
(
"Login user desarrollo"
)
response
=
make_response
(
redirect
(
url_for
(
'historico'
)))
#response = make_response('', 200)
response
.
headers
[
'Location'
]
=
"historico"
response
.
set_cookie
(
"login"
,
user
,
60
*
60
*
8
,
httponly
=
True
)
return
response
# Login rapido para desarrollo
except
Exception
as
E
:
print
(
f
"No se encontro usuariodesarrollo {E}"
)
try
:
s
=
SI
(
SI
.
Chrome
)
r
=
make_response
(
json
.
dumps
(
...
...
protected_static/buscador.js
0 → 100644
View file @
ba6a9b3
const
idCentGlobal
=
'61'
;
///Declaracion de taller
const
chatUrl
=
'https://api.hgt.com.ar/poll/rto_'
+
idCentGlobal
+
'_update/dewfrfgbeolkgkteprlk,hptrlk,hqff'
;
let
pendingRequests
=
0
;
function
CargarLista
()
{
const
requestData
=
{
"token"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"url"
:
"https://hgt.hgt.com.ar/api_rto/diaria"
,
"clear"
:
true
,
"params"
:
{
"ApiKey"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"id_cent"
:
idCentGlobal
}
};
fetch
(
'https://api.hgt.com.ar/redirect'
,
{
method
:
'POST'
,
headers
:
{
'Accept'
:
'application/json'
,
"Content-Type"
:
"application/json"
},
body
:
JSON
.
stringify
(
requestData
)
})
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
createHistoricoList
(
data
);
})
.
catch
(
error
=>
{
console
.
error
(
'Error:'
,
error
);
});
};
// Function to create the list items
function
createHistoricoList
(
data
)
{
const
historicoDiv
=
document
.
getElementById
(
'div_historico'
);
historicoDiv
.
innerHTML
=
""
;
//historicoDiv.innerText = "Dominios del dia"
data
.
inspecciones
.
forEach
(
inspeccion
=>
{
const
button
=
document
.
createElement
(
'button'
);
button
.
className
=
'PDFButton'
;
button
.
id
=
inspeccion
.
name
;
button
.
textContent
=
'Ir dominio '
;
const
div
=
document
.
createElement
(
'div'
);
//div.textContent = inspeccion.name + " " + inspeccion.resultado + " " + inspeccion.fecha + " ";
const
titulo
=
document
.
createElement
(
'H4'
);
titulo
.
textContent
=
inspeccion
.
name
+
" "
+
inspeccion
.
resultado
;
const
ftl
=
document
.
createElement
(
'H6'
);
ftl
.
textContent
=
"Linea "
+
inspeccion
.
linea
+
", Planilla "
+
inspeccion
.
numeroplanilla
+
", Categoria "
+
inspeccion
.
categoria
;
div
.
appendChild
(
titulo
);
div
.
appendChild
(
ftl
);
div
.
appendChild
(
button
);
const
separador
=
document
.
createElement
(
'hr'
)
separador
.
className
=
'custom-hr'
;
historicoDiv
.
appendChild
(
div
);
historicoDiv
.
appendChild
(
separador
);
});
}
async
function
fetchChat
()
{
const
MensajeDiv
=
document
.
getElementById
(
'DivMensajeFijo'
);
const
MensajeCaida
=
"Se perdio contacto con el server, revise conexcion a internet"
//MensajeDiv.innerText = "Escuchando novedades"
while
(
true
)
{
try
{
const
response
=
await
fetch
(
chatUrl
);
const
data
=
await
response
.
json
();
if
(
data
.
proccess
===
true
)
{
//CargarLista();
MensajeDiv
.
innerText
=
"Lista Actualizada al "
+
data
.
tiempo
}
if
(
MensajeDiv
.
innerText
==
MensajeCaida
)
{
MensajeDiv
.
innerText
=
"Se recupero conixion al server, Esperando novedades, o recarge la pagina"
}
}
catch
(
error
)
{
MensajeDiv
.
innerText
=
MensajeCaida
;
// Si ocurre un error, esperamos 5 segundos antes de volver a intentarlo
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
5000
));
}
}
}
function
BuscarLista
(
fecha
,
dominio
)
{
const
requestData
=
{
"token"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"url"
:
"https://hgt.hgt.com.ar/api_rto/buscador"
,
"clear"
:
true
,
"params"
:
{
"ApiKey"
:
"sdñÑREgerqw3$E#]ÑgdfbversdfFfew435"
,
"id_cent"
:
idCentGlobal
,
//"id_cent": "61",
"fecha"
:
fecha
,
"dominio"
:
dominio
}
};
fetch
(
'https://api.hgt.com.ar/redirect'
,
{
method
:
'POST'
,
headers
:
{
'Accept'
:
'application/json'
,
"Content-Type"
:
"application/json"
},
body
:
JSON
.
stringify
(
requestData
)
})
.
then
(
response
=>
response
.
json
())
.
then
(
data
=>
{
createHistoricoList
(
data
);
})
.
catch
(
error
=>
{
console
.
error
(
'Error:'
,
error
);
});
};
async
function
IniciarInterfaceBusqueda
()
{
const
searchForm
=
document
.
getElementById
(
'searchForm'
);
searchForm
.
addEventListener
(
'submit'
,
function
(
event
)
{
event
.
preventDefault
();
// Prevent the form from submitting normally
//console.log("Presionando boton busqueda")
const
fecha
=
document
.
getElementById
(
'date_input'
).
value
;
const
dominio
=
document
.
getElementById
(
'domain_input'
).
value
;
if
(
fecha
===
""
&&
dominio
===
""
)
{
alert
(
"Carge los parametros de busqueda"
);
return
;
// Stop further execution if validation fails
}
else
{
BuscarLista
(
fecha
,
dominio
);
}
})
}
////////////INICIO ACTIVIDAD
window
.
addEventListener
(
'load'
,
()
=>
{
//CargarLista();
//fetchChat();
IniciarInterfaceBusqueda
();
});
\ No newline at end of file
pruebas.py
View file @
ba6a9b3
login
=
{
"jpdure"
:
"xvc7733455XVC"
}
report
=
{
'header'
:
{
'patente'
:
'PRUEBA12'
,
...
...
templates/buscador.html
0 → 100755
View file @
ba6a9b3
<html
lang=
"es"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<link
rel=
"stylesheet"
href=
"{{ url_for('static', filename = 'styles/general.css') }}"
>
<script
src=
"/protected_static/buscador.js"
></script>
<!--INCLUIMOS LA FUENTE
<link rel="stylesheet" media="screen" href="https://fontlibrary.org/face/cmu-typewriter" type="text/css" />
-->
<title>
Pruebas de Alineamiento
</title>
<style>
.custom-hr
{
border
:
none
;
border-top
:
1px
solid
#000
;
/* Personaliza el color y grosor aquí */
width
:
66.67%
;
/* Dos tercios del ancho de la página */
margin
:
20px
0
;
/* Ajusta el espacio alrededor de la línea aquí */
margin-left
:
0
;
/* Alinea la línea al inicio (izquierda) */
}
</style>
</head>
<body>
<div
>
<!--
<div class="MessageFixed" id="DivMensajeFijo">
</div>
-->
<div
class=
"DataCard"
>
<form
id=
"searchForm"
>
<div>
<label
for=
"date_input"
>
Fecha:
</label>
<input
type=
"date"
id=
"date_input"
name=
"date_input"
>
</div>
<div>
<label
for=
"domain_input"
>
Dominio:
</label>
<input
type=
"text"
id=
"domain_input"
name=
"domain_input"
>
</div>
<button
class=
"PDFButton"
type=
"submit"
id=
"id_boton_busqueda"
>
Buscar
</button>
</form>
<hr
class=
"custom-hr"
>
Resultados de la busqueda
<br>
<div
id=
"div_historico"
>
<hr
class=
"custom-hr"
>
Sin resultados
<hr
class=
"custom-hr"
>
</div>
</div>
<div
class=
"PDFButtonContainerFixed"
>
<h3>
Buscador
</h3>
<button
class=
"PDFButton"
onclick=
"location.href='/historico'"
>
Historico
</button>
<button
class=
"PDFButton"
onclick=
"location.href='/'"
>
Carga
</button>
</div>
</div>
<div
id=
"message"
class=
"MessageContainer"
onclick=
"this.style.display = 'none'"
style=
"display: none;"
>
<div
class=
"Message"
style=
"text-align: center;"
>
<p
id =
"msg"
></p>
<span
class =
"X"
>
x
<span>
</div>
</div>
</body>
</html>
\ No newline at end of file
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment