improve readability sql_alch, mapsgen, iplocate

This commit is contained in:
devfzn 2024-03-05 00:53:17 -03:00
parent dc83b9082d
commit 7a30ea3e33
3 changed files with 234 additions and 119 deletions

View File

@ -301,16 +301,22 @@ def main():
pais = sys.argv[3] pais = sys.argv[3]
fecha_local = sys.argv[4] fecha_local = sys.argv[4]
fecha_unix = sql_alch.fecha_error_to_epoch( fecha_unix = sql_alch.fecha_error_to_epoch(
sys.argv[4]+' 00:00:00') sys.argv[4]+' 00:00:00'
)
querys.pt_sel_pais_fecha( querys.pt_sel_pais_fecha(
pais.upper(), fecha_unix, fecha_local) pais.upper(),
fecha_unix,
fecha_local
)
case '--detalle-pais': case '--detalle-pais':
pais = sys.argv[3] pais = sys.argv[3]
if len(sys.argv) > 4: if len(sys.argv) > 4:
if sys.argv[4].isnumeric(): if sys.argv[4].isnumeric():
codigo = sys.argv[4] codigo = sys.argv[4]
querys.pt_visita_pais_detalle( querys.pt_visita_pais_detalle(
pais.upper(), codigo) pais.upper(),
codigo
)
else: else:
console.print( console.print(
'[magenta]-q --detalle-pais <pais> ' '[magenta]-q --detalle-pais <pais> '

View File

@ -16,8 +16,13 @@ def map200(geolocs):
lat = float(loc[0].split(',')[0]) lat = float(loc[0].split(',')[0])
lon = float(loc[0].split(',')[1]) lon = float(loc[0].split(',')[1])
marca200 = staticmaps.create_latlng(lat, lon) marca200 = staticmaps.create_latlng(lat, lon)
cntxt200.add_object(staticmaps.Marker( cntxt200.add_object(
marca200, color=staticmaps.parse_color('#00ff29'), size=7)) staticmaps.Marker(
marca200,
color=staticmaps.parse_color('#00ff29'),
size=7
)
)
svg_image = cntxt200.render_svg(1920, 1080) svg_image = cntxt200.render_svg(1920, 1080)
with open(f"{selfpath}/maps/map_200.svg", "w", encoding="utf-8") as f: with open(f"{selfpath}/maps/map_200.svg", "w", encoding="utf-8") as f:
@ -51,15 +56,25 @@ def maps_gen(locs_200, locs_300):
lat = float(loc[0].split(',')[0]) lat = float(loc[0].split(',')[0])
lon = float(loc[0].split(',')[1]) lon = float(loc[0].split(',')[1])
marca3 = staticmaps.create_latlng(lat, lon) marca3 = staticmaps.create_latlng(lat, lon)
cntxtAll.add_object(staticmaps.Marker( cntxtAll.add_object(
marca3, color=staticmaps.parse_color('#b20101'), size=5)) staticmaps.Marker(
marca3,
color=staticmaps.parse_color('#b20101'),
size=5
)
)
for loc in locs_200: for loc in locs_200:
lat = float(loc[0].split(',')[0]) lat = float(loc[0].split(',')[0])
lon = float(loc[0].split(',')[1]) lon = float(loc[0].split(',')[1])
marca3 = staticmaps.create_latlng(lat, lon) marca3 = staticmaps.create_latlng(lat, lon)
cntxtAll.add_object(staticmaps.Marker( cntxtAll.add_object(
marca3, color=staticmaps.parse_color('#00ff29'), size=6)) staticmaps.Marker(
marca3,
color=staticmaps.parse_color('#00ff29'),
size=6
)
)
svg_image = cntxtAll.render_svg(1920, 1080) svg_image = cntxtAll.render_svg(1920, 1080)
with open(f"{selfpath}/maps/map_all.svg", "w", encoding="utf-8") as f: with open(f"{selfpath}/maps/map_all.svg", "w", encoding="utf-8") as f:
@ -78,15 +93,25 @@ def maps_thumbs(locs_200, locs_300):
lat = float(loc[0].split(',')[0]) lat = float(loc[0].split(',')[0])
lon = float(loc[0].split(',')[1]) lon = float(loc[0].split(',')[1])
demo300 = staticmaps.create_latlng(lat, lon) demo300 = staticmaps.create_latlng(lat, lon)
cntxtdemo.add_object(staticmaps.Marker( cntxtdemo.add_object(
demo300, color=staticmaps.parse_color('#b20101'), size=4)) staticmaps.Marker(
demo300,
color=staticmaps.parse_color('#b20101'),
size=4
)
)
for loc in locs_200: for loc in locs_200:
lat = float(loc[0].split(',')[0]) lat = float(loc[0].split(',')[0])
lon = float(loc[0].split(',')[1]) lon = float(loc[0].split(',')[1])
demo200 = staticmaps.create_latlng(lat, lon) demo200 = staticmaps.create_latlng(lat, lon)
cntxtdemo.add_object(staticmaps.Marker( cntxtdemo.add_object(
demo200, color=staticmaps.parse_color('#00ff29'), size=5)) staticmaps.Marker(
demo200,
color=staticmaps.parse_color('#00ff29'),
size=5
)
)
svg_thumb = cntxtdemo.render_svg(1024, 768) svg_thumb = cntxtdemo.render_svg(1024, 768)
with open(f"{selfpath}/maps/map_thumb.svg", "w", encoding="utf-8") as f: with open(f"{selfpath}/maps/map_thumb.svg", "w", encoding="utf-8") as f:

View File

@ -2,15 +2,23 @@ import os
import time import time
import subprocess import subprocess
from consultas.querys_sqlite import get_geoloc from consultas.querys_sqlite import get_geoloc
from iplocate import requests, token, filtro_ip_propia, selfpath, parser, log_usage, valid_ip from iplocate import (
requests,
token,
filtro_ip_propia,
selfpath,
parser,
log_usage,
valid_ip
)
from json import loads from json import loads
from datetime import datetime from datetime import datetime
from sqlalchemy import create_engine from sqlalchemy import create_engine
from sqlalchemy.orm import relationship, sessionmaker from sqlalchemy.orm import relationship, sessionmaker
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, Sequence, update from sqlalchemy import Column, Integer, String, Sequence, update
from sqlalchemy.orm.session import Session # from sqlalchemy.orm.session import Session
from sqlalchemy.sql.expression import distinct, select from sqlalchemy.sql.expression import select # , distinct
from sqlalchemy.sql.schema import ForeignKey from sqlalchemy.sql.schema import ForeignKey
from rich.progress import Progress, track from rich.progress import Progress, track
from rich.console import Console from rich.console import Console
@ -40,24 +48,29 @@ class Registro(Base):
fecha_reg = Column(Integer, default=int(time.mktime(time.localtime()))) fecha_reg = Column(Integer, default=int(time.mktime(time.localtime())))
tzone = Column(String, nullable=True) tzone = Column(String, nullable=True)
cod_post = Column(String, nullable=True) cod_post = Column(String, nullable=True)
#link = Column(String, nullable=True) visitas = relationship(
visitas = relationship("Visita", "Visita",
order_by="Visita.id", order_by="Visita.id",
back_populates="visita_ip", back_populates="visita_ip",
cascade="all, delete, delete-orphan") cascade="all, delete, delete-orphan"
)
def get_fecha(self): def get_fecha(self):
"""Convierte fecha 'unix epoch' y devuelve en formato local""" """Convierte fecha 'unix epoch' y devuelve en formato local"""
return time.asctime(time.localtime(int(self.fecha_reg.__repr__()))) return time.asctime(
time.localtime(
int(self.fecha_reg.__repr__())
)
)
def __repr__(self) -> str: def __repr__(self) -> str:
# print('en repr')
try: try:
rep = f'ip={self.ip};host={self.hostname};anycast={self.anycast};'+\ rep = f'ip={self.ip};host={self.hostname};' \
f'cuidad={self.cuidad};region={self.region};pais={self.pais};'+\ f'anycast={self.anycast};cuidad={self.cuidad};' \
f'geoloc={self.geoloc};organizacion={self.organizacion};'+\ f'region={self.region};pais={self.pais};' \
f'fecha_reg={self.get_fecha()};tzone={self.tzone};cod_post={self.cod_post}' f'geoloc={self.geoloc};organizacion={self.organizacion};' \
# print('Repr:', rep) f'fecha_reg={self.get_fecha()};tzone={self.tzone};' \
f'cod_post={self.cod_post}'
return rep return rep
except Exception as ex: except Exception as ex:
print('Exception :', ex) print('Exception :', ex)
@ -78,7 +91,11 @@ class Visita(Base):
def get_fecha(self): def get_fecha(self):
"""Convierte fecha 'unix epoch' y devuelve en formato local""" """Convierte fecha 'unix epoch' y devuelve en formato local"""
return time.asctime(time.localtime(int(self.fecha.__repr__()))) return time.asctime(
time.localtime(
int(self.fecha.__repr__())
)
)
def consulta_registro(self): def consulta_registro(self):
return True if self.registro == 1 else False return True if self.registro == 1 else False
@ -86,8 +103,9 @@ class Visita(Base):
def __repr__(self) -> str: def __repr__(self) -> str:
"""Representación en cadena de texto del los datos en tabla""" """Representación en cadena de texto del los datos en tabla"""
try: try:
rep = f'id={self.id},ip={self.ip},html={self.cod_html},'\ rep = f'id={self.id},ip={self.ip},html={self.cod_html},' \
f'fecha={self.get_fecha()},metodo={self.metodo},request={self.consulta}' f'fecha={self.get_fecha()},metodo={self.metodo}' \
f',request={self.consulta}'
return rep return rep
except Exception as ex: except Exception as ex:
print('Exception :', ex) print('Exception :', ex)
@ -96,7 +114,6 @@ class Visita(Base):
engine = create_engine(base_de_datos) engine = create_engine(base_de_datos)
Base.metadata.create_all(engine) Base.metadata.create_all(engine)
# Base.metadata.create_all(engine.execution_options(synchronize_session="fetch"))
Session = sessionmaker(bind=engine) Session = sessionmaker(bind=engine)
session = Session() session = Session()
@ -112,7 +129,7 @@ fecha_access = "10/May/2022:11:42:14 -0400".split(' ')[0]
def fecha_access_to_epoch(fecha): def fecha_access_to_epoch(fecha):
"""Convierte la fecha del formato entregado por access.log """Convierte la fecha del formato entregado por access.log
y reverse_access.log(nginx) al formato unix epoch. y reverse_access.log (nginx) al formato unix epoch.
:fecha: str Fecha :fecha: str Fecha
:returns: int unix epoch fecha (secs) :returns: int unix epoch fecha (secs)
""" """
@ -145,7 +162,11 @@ def ip_registrada(ip):
en tabla 'Visita' para ip pasada como argumento. en tabla 'Visita' para ip pasada como argumento.
""" """
try: try:
ip_reg = session.query(Visita).filter(Visita.ip == ip).filter(Visita.registro == 1).first() ip_reg = session.query(Visita).filter(
Visita.ip == ip
).filter(
Visita.registro == 1
).first()
except Exception as ex: except Exception as ex:
print('Exception', ex) print('Exception', ex)
ip_reg = None ip_reg = None
@ -154,20 +175,29 @@ def ip_registrada(ip):
def carga_access_log(log): def carga_access_log(log):
"""Procesa logs del tipo access, filtra IPs propias (publica y locales), """Procesa logs del tipo access, filtra IPs propias (publica y locales),
acorta los donde es necesario, convierte fechas a formato unix epoch, acorta las peticiones donde es necesario, convierte fechas a formato unix
los añade a session para tabla 'Visita'. epoch, los añade a la session para la tabla 'Visita'.
Finalmente realiza la transaccion utilizando clase Progres() del modulo rich. Finalmente realiza la transaccion utilizando clase Progres() del modulo
Y borra el log procesado. rich. Borra el log procesado."""
"""
if os.path.exists(log): if os.path.exists(log):
nombre_log = log.split('/')[-1] nombre_log = log.split('/')[-1]
console.print(f'[yellow]Procesando [[/yellow]{nombre_log}[yellow]][/yellow]') console.print(
f'[yellow]Procesando [[/yellow]{nombre_log}[yellow]][/yellow]'
)
try: try:
with open(log, 'r') as lista: with open(log, 'r') as lista:
try: try:
largo = subprocess.run(['wc', '-l', log], capture_output=True, text=True) largo = subprocess.run(
['wc', '-l', log],
capture_output=True,
text=True
)
largo = int(largo.stdout.split(' ')[0]) largo = int(largo.stdout.split(' ')[0])
for linea in track(lista, total=largo, description='[blue bold]Cargando [/blue bold]'): for linea in track(
lista,
total=largo,
description='[blue bold]Cargando [/blue bold]'
):
ip = linea.split(' ')[0] ip = linea.split(' ')[0]
if filtro_ip_propia(ip): if filtro_ip_propia(ip):
try: try:
@ -179,19 +209,19 @@ def carga_access_log(log):
metodo = linea.split('"')[1].split(' ')[0] metodo = linea.split('"')[1].split(' ')[0]
if len(metodo) > 10 or len(metodo) < 2: if len(metodo) > 10 or len(metodo) < 2:
metodo = '---' metodo = '---'
except Exception as ex: except Exception:
metodo = '---' metodo = '---'
try: try:
url = linea.split('"')[1].split(' ')[1] url = linea.split('"')[1].split(' ')[1]
if len(url) > 254: if len(url) > 254:
url = url[:252]+'...' url = url[:252]+'...'
except Exception as ex: except Exception:
url = '---' url = '---'
try: try:
codigo = int(linea.split('"')[2].split(' ')[1]) codigo = int(linea.split('"')[2].split(' ')[1])
if len(str(codigo)) != 3: if len(str(codigo)) != 3:
codigo = 0 codigo = 0
except Exception as ex: except Exception:
codigo = 0 codigo = 0
try: try:
fecha = linea.split(' ')[3][1:] fecha = linea.split(' ')[3][1:]
@ -216,48 +246,70 @@ def carga_access_log(log):
print('Exception: ', ex) print('Exception: ', ex)
try: try:
with Progress() as prog, session: with Progress() as prog, session:
task1 = prog.add_task("[yellow bold]Guardando[/yellow bold]", total=len(session.new)) task1 = prog.add_task(
"[yellow bold]Guardando[/yellow bold]",
total=len(session.new)
)
session.commit() session.commit()
while not prog.finished: while not prog.finished:
prog.update(task1, advance=0.1) prog.update(task1, advance=0.1)
time.sleep(0.05) time.sleep(0.05)
except Exception as ex: except Exception as ex:
print('Exception Progress: ', ex) print('Exception Progress: ', ex)
console.print('[magenta] - Carga completa.. borrando log[/magenta]\n') console.print(
'[magenta] - Carga completa.. borrando log[/magenta]\n'
)
os.remove(log) os.remove(log)
return True return True
except: except Exception:
console.print(f'[red]Error al intentar abrir/cargar: [{log}[/red]]\n') console.print(
f'[red]Error al intentar abrir/cargar: [{log}[/red]]\n'
)
return False return False
else: else:
console.print(f'[bold red]Log: [[/bold red]{log}[bold red]] inexistente.[/bold red]\n') console.print(
f'[bold red]Log: [[/bold red]{log}[bold red]] '
'inexistente.[/bold red]\n'
)
return False return False
def carga_error_logs(log): def carga_error_logs(log):
"""Procesa logs del tipo error, acorta los donde es necesario, convierte fechas """Procesa logs del tipo error, acorta los donde es necesario, convierte
a formato unix epoch, filtra IPs propias (publica y locales), los añade a session fechas a formato unix epoch, filtra IPs propias (publica y locales), los
para tabla 'Visita'. añade a session para tabla 'Visita'.
Finalmente realiza la transaccion utilizando clase 'Progress' del modulo rich. Finalmente realiza la transaccion utilizando clase 'Progress' del modulo
Y borra el log procesado. rich. Borra el log procesado."""
"""
if os.path.exists(log): if os.path.exists(log):
nombre_log = log.split('/')[-1] nombre_log = log.split('/')[-1]
console.print(f'[yellow]Procesando [[/yellow]{nombre_log}[yellow]][/yellow]') console.print(
f'[yellow]Procesando [[/yellow]{nombre_log}[yellow]][/yellow]'
)
try: try:
with open(log, 'r') as lista: with open(log, 'r') as lista:
ip, fecha, url, metodo = None, None, None, None ip, fecha, url, metodo = None, None, None, None
try: try:
largo = subprocess.run(['wc', '-l', log], capture_output=True, text=True) largo = subprocess.run(
['wc', '-l', log],
capture_output=True,
text=True
)
largo = int(largo.stdout.split(' ')[0]) largo = int(largo.stdout.split(' ')[0])
for linea in track(lista, total=largo, description='[blue bold]Cargando [/blue bold]'): for linea in track(
lista,
total=largo,
description='[blue bold]Cargando [/blue bold]'
):
linea = linea.split('\n')[0] linea = linea.split('\n')[0]
if (linea.rfind('[notice]') > 0 or linea.rfind('[crit]') > 0): if (linea.rfind('[notice]') > 0 or linea.rfind('[crit]') > 0):
if linea.find('[crit]') > 0: if linea.find('[crit]') > 0:
try: try:
ip = linea.split('client: ')[1].split(',')[0] ip = linea.split('client: ')[1].split(',')[0]
except Exception as ex: except Exception as ex:
log_usage('Exception Ip error_log {crit}', ex) log_usage(
'Exception Ip error_log {crit}',
ex
)
ip = None ip = None
try: try:
fecha = ' '.join(linea.split(' ')[0:2]) fecha = ' '.join(linea.split(' ')[0:2])
@ -277,7 +329,10 @@ def carga_error_logs(log):
try: try:
ip = linea.split('client: ')[1].split(',')[0] ip = linea.split('client: ')[1].split(',')[0]
except Exception as ex: except Exception as ex:
log_usage('Exception Ip error_log {notice}', ex) log_usage(
'Exception Ip error_log {notice}',
ex
)
ip = None ip = None
try: try:
fecha = ' '.join(linea.split(' ')[0:2]) fecha = ' '.join(linea.split(' ')[0:2])
@ -298,46 +353,65 @@ def carga_error_logs(log):
fecha = int(fecha_error_to_epoch(fecha)) fecha = int(fecha_error_to_epoch(fecha))
codigo = 0 codigo = 0
if ip_registrada(ip): if ip_registrada(ip):
session.add(Visita(ip=ip, session.add(
Visita(
ip=ip,
cod_html=codigo, cod_html=codigo,
fecha=fecha, fecha=fecha,
consulta=url, consulta=url,
metodo=metodo, metodo=metodo,
registro=1)) registro=1
)
)
else: else:
session.add(Visita(ip=ip, session.add(
Visita(
ip=ip,
cod_html=codigo, cod_html=codigo,
fecha=fecha, fecha=fecha,
consulta=url, consulta=url,
metodo=metodo)) metodo=metodo
)
)
else: else:
log_usage('carga error.log', linea) log_usage('carga error.log', linea)
except Exception as ex: except Exception as ex:
print('[Procesando *Error.log] Exception: ', ex) print('[Procesando *Error.log] Exception: ', ex)
try: try:
info_error = f'IP:[{ip}] - FECHA:[{fecha}] - METODO:[{metodo}] - URL:[{url}]' info_error = f'IP:[{ip}] - FECHA:[{fecha}] - ' \
f'METODO:[{metodo}] - URL:[{url}]'
log_usage('Exception error.log', info_error) log_usage('Exception error.log', info_error)
except: except Exception:
pass pass
try: try:
with Progress() as prog, session: with Progress() as prog, session:
task1 = prog.add_task("[yellow bold]Guardando[/yellow bold]", total=len(session.new)) task1 = prog.add_task(
"[yellow bold]Guardando[/yellow bold]",
total=len(session.new)
)
session.commit() session.commit()
while not prog.finished: while not prog.finished:
prog.update(task1, advance=0.1) prog.update(task1, advance=0.1)
time.sleep(0.05) time.sleep(0.05)
except Exception as ex: except Exception as ex:
log_usage('Exception error.log - Progress session commit', ex) log_usage('Exception error.log - Progress session commit', ex)
console.print(f'[magenta] - Carga completa.. borrando log[/magenta]\n') console.print(
'[magenta] - Carga completa.. borrando log[/magenta]\n'
)
os.remove(log) os.remove(log)
return True return True
except: except Exception:
console.print(f'[red]Error al intentar abrir/cargar: [{log}[/red]]\n') console.print(
log_usage(f'Error al abrir/cargar', log) f'[red]Error al intentar abrir/cargar: [{log}[/red]]\n'
)
log_usage('Error al abrir/cargar', log)
return False return False
else: else:
console.print(f'[bold red]Log: [[/bold red]{log}[bold red]] inexistente.[/bold red]\n') console.print(
log_usage(f'Log inexistente', log) f'[bold red]Log: [[/bold red]{log}[bold red]]'
' inexistente.[/bold red]\n'
)
log_usage('Log inexistente', log)
return False return False
@ -375,7 +449,9 @@ def carga_registro_ip(ip_info):
info_dic['tzone'] = ip_info['timezone'] if 'timezone' in ip_info else None info_dic['tzone'] = ip_info['timezone'] if 'timezone' in ip_info else None
info_dic['cod_post'] = ip_info['postal'] if 'postal' in ip_info else None info_dic['cod_post'] = ip_info['postal'] if 'postal' in ip_info else None
try: try:
session.add(Registro(ip=info_dic['ip'], session.add(
Registro(
ip=info_dic['ip'],
hostname=info_dic['hostname'], hostname=info_dic['hostname'],
anycast=info_dic['anycast'], anycast=info_dic['anycast'],
cuidad=info_dic['ciudad'], cuidad=info_dic['ciudad'],
@ -386,14 +462,17 @@ def carga_registro_ip(ip_info):
fecha_reg=int(time.mktime(time.localtime())), fecha_reg=int(time.mktime(time.localtime())),
tzone=info_dic['tzone'], tzone=info_dic['tzone'],
cod_post=info_dic['cod_post'], cod_post=info_dic['cod_post'],
)) )
)
session.commit() session.commit()
except Exception as ex: except Exception as ex:
print('[session.commit(ADD REGISTRO)] Exception: ', ex) print('[session.commit(ADD REGISTRO)] Exception: ', ex)
print('Datos-Dic: ', info_dic) print('Datos-Dic: ', info_dic)
stmt = update(Visita).where(Visita.ip == ip_info['ip']).values(registro=1).\ stmt = update(Visita).where(
execution_options(synchronize_session="fetch") Visita.ip == ip_info['ip']
# result = session.execute(stmt) ).values(
registro=1
).execution_options(synchronize_session="fetch")
try: try:
session.execute(stmt) session.execute(stmt)
session.commit() session.commit()
@ -426,7 +505,9 @@ def consulta_db(ip):
y sus detalles. y sus detalles.
""" """
try: try:
statement = session.query(Registro, Visita).join('visitas').filter_by(ip=ip) statement = session.query(
Registro, Visita
).join('visitas').filter_by(ip=ip)
result = session.execute(statement).all() result = session.execute(statement).all()
return result return result
except Exception as ex: except Exception as ex:
@ -441,13 +522,15 @@ def registro_ips():
statement = select(Visita).filter_by(registro=0) statement = select(Visita).filter_by(registro=0)
with Progress() as progress: with Progress() as progress:
total = len(session.execute(statement).scalars().all()) total = len(session.execute(statement).scalars().all())
task1 = progress.add_task("[bold blue]Cargando [/bold blue]", total=total) task1 = progress.add_task(
"[bold blue]Cargando [/bold blue]",
total=total
)
total_ant = total total_ant = total
while not progress.finished: while not progress.finished:
res = session.execute(statement).scalars().first() res = session.execute(statement).scalars().first()
total_act = len(session.execute(statement).scalars().all()) total_act = len(session.execute(statement).scalars().all())
avance = total_ant - total_act avance = total_ant - total_act
# print('total update:',total,'total_act:', total_act,' Diferencia: ', avance )
total_ant = total_act total_ant = total_act
if res is None: if res is None:
progress.update(task1, advance=avance) progress.update(task1, advance=avance)
@ -456,15 +539,16 @@ def registro_ips():
ip_info = consulta_ip(ip_actual, True) ip_info = consulta_ip(ip_actual, True)
carga_registro_ip(ip_info) carga_registro_ip(ip_info)
progress.update(task1, advance=avance) progress.update(task1, advance=avance)
console.print('\n[bold yellow]Registro en base de datos finalizado.[/bold yellow]') console.print(
'\n[bold yellow]Registro en base de datos finalizado.[/bold yellow]'
)
def mapsgen(): def mapsgen():
"""Realiza 2 consultas de los datos de columna 'geoloc' de la tabla 'Registro', """Realiza 2 consultas de los datos de columna 'geoloc' de la tabla
según valor de columna 'cod_html' de la tabla 'Visita', para valores 200 y para 'Registro' según valor de columna 'cod_html' de la tabla 'Visita',
otros valores. para valores 200 y otros. Llama a función maps_gen con estas listas
Llama a función maps_gen con estas listas de valores como argumentos. de valores como argumentos."""
"""
try: try:
loc_200 = get_geoloc(200) loc_200 = get_geoloc(200)
loc_300 = get_geoloc(300) loc_300 = get_geoloc(300)