-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpymgamnf.py
110 lines (99 loc) · 3.43 KB
/
pymgamnf.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import re
import os
import sys
import ctypes
import quopri
import telegram
import pdfkit
import datetime
import pandas as pd
import numpy as np
from time import sleep
import platform
from colorama import init, Fore, Back, Style
from tinydb import TinyDB, Query
db = TinyDB('test.json')
init()
filePath = str(sys.argv[1])
list_pnrdata=[]
#print("El archivo es %s" % filePath)
#mail = imaplib.IMAP4_SSL('imap.gmail.com',993)
#unm = '[email protected]'
#pwd = 'aruba297!!'
#mail.login(unm,pwd)
#mail.select("INBOX")
#tst_contacts=['[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]']
#aua_contacts=['[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]',
# '[email protected]',
# ]
#mailtothis = '[email protected]'
#mailtothis = '[email protected]'
#server = smtplib.SMTP('smtp.gmail.com:587')
#server.starttls()
#server.login(unm,pwd)
#bot = telegram.Bot(token="394211218%3AAAF7EfA7GHw6nccUJQIUhIGlegQTWXgkBMg")
#chat_id = "14185356"
global bagi
def getprldata(prlfile):
with open(prlfile) as f:
for line in f:
if line.startswith('.L/'):
pnrsearch = line.strip("\.L/")
if pnrsearch:
pnr = pnrsearch
# print (pnr)
else:
pnr=""
if line.startswith(".R/DOCS"):
param, value = line.split("DOCS HK1",1)
nextline = next(f)
print (nextline)
names = "%s" % nextline
#print(names)
namess = names.split(".RN/")
testit = "".join(namess)
print(testit)
#print(namess)
newvalue = "%s%s" % (value.strip('\n'),testit)
print(newvalue)
#print(truevalue)
finalvalue = re.split(r'/', newvalue)
#print (finalvalue)
#print(value)
if line.startswith('.W/K/'):
bagsearch = line.strip("\.W/K/")
bagit=re.search("\.W/K/(.+?)/0$",line)
if bagit.groups()[0]:
bagi=bagit.groups()[0]
print(bagi)
else:
bagi="000"
print("esto esta asi %s" % (bagi))
if line.startswith('.R/SEAT'):
seatsearch = re.search("\.R/SEAT (.+?)$",line)
if seatsearch:
seat = seatsearch.groups()[0]
seat=seat.strip('0')
list_pnrdata.append([pnr.strip('\n'),finalvalue[8].strip('\n'),finalvalue[9].strip('\n'),finalvalue[4],finalvalue[3],finalvalue[5],seat, bagi])
return list_pnrdata
def printlist(listpnr):
print(listpnr)
lospnrs=getprldata(filePath)
printlist(lospnrs)
#print (len(list_apis))
#for pax in list_apis:
# print (pax)