- requests
from requests import get
from operator import add
from js import document,alert
import webbrowser
def gerar(*args, **kwargs):
usercte = list(map(int, (document.getElementById('awb').value).split()))
purecte = [str(i).replace( '957', '') for i in usercte]
cte_prefix = [cte_prefix[:4] for cte_prefix in purecte]
cte_sufix = [cte_sufix[4:11] for cte_sufix in purecte]
prefix_url = 'http://cronos.lancargo.com/CronosO2Br-1.0/reportpdfservlet?option=DACTE&source=eTracking&prefix='
url_first = [prefix_url + sub + '&number=' for sub in cte_prefix]
sufix_url = '&username=etracking&station=GRU&language=EN'
url_second = [l + sufix_url for l in cte_sufix]
fullcte = list( map(add, url_first, url_second))
pyscript.write('linkcompleto', fullcte)
for i in fullcte:
webbrowser.open(i)