-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexcel.py
100 lines (89 loc) · 3.23 KB
/
excel.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
import xlrd
import pandas as pd
import var
import random
import time
class Excel():
def __init__(self):
pass
def readPva(self, pvaPath):
data = pd.read_excel (pvaPath, 'Sheet1')
df = data.to_dict()
return df
def readMessage(self, messagePath):
data = pd.read_excel (messagePath, 'Sheet1')
df = data.to_dict()
return df
def main():
try:
with open("userPass.txt", "r", encoding="utf-8") as f:
data = f.read()
data = data.split(",")
var.proxyUser = data[0]
var.proxyPassword = data[1]
print(var.proxyPassword, var.proxyUser)
except Exception as e:
print(e)
readPva = Excel()
pvaList = readPva.readPva(var.pvaPath)
messageList = readPva.readPva(var.messagePath)
l = var.infoLen = len(pvaList["Imap"])
if var.typeSelect == "activity":
_temp = "community activity-partners"
else:
_temp = "missed-connections"
messageLen = len(messageList["Title"]) - 1
for i in range(l):
tempIndex = random.randint(0, messageLen)
print(messageLen, tempIndex)
temp = {
"clAccount": pvaList["CL Account Login"][i],
"clEmail": pvaList["CL Email"][i],
"clPassword": pvaList["CL Password"][i],
"State": pvaList["State"][i],
"City": pvaList["City"][i],
"Zip": pvaList["Zip"][i],
"Email": pvaList["Email"][i],
"Password": pvaList["Password"][i],
"Port": pvaList["Port"][i],
"Imap": pvaList["Imap"][i],
"Link": pvaList[_temp][i],
"title": messageList["Title"][tempIndex],
"message": messageList["Message"][tempIndex]
}
var.info.append(temp.copy())
var.infoQ.put(temp.copy())
print(var.info[0])
var.monitorQ.put('''<p><span style="color: #0C5E3E; font-size: 30px;">{} </span><br>'''.format("Data loading Finshed"))
if __name__ == '__main__':
readPva = Excel()
pvaList = readPva.readPva("E:/Suvo/craigslist/pva.xlsx")
# print(df["Imap"][0])
messageList = readPva.readPva("E:/Suvo/craigslist/message-1.xlsx")
# print(df["Title"][0])
# print(pvaList.keys())
# print(messageList["Message"][0])
l = len(pvaList["Imap"])
if var.typeSelect == "activity":
_temp = "community activity-partners"
else:
_temp = "missed-connections"
for i in range(l):
temp = {
"clAccount": pvaList["CL Account Login"][i],
"clEmail": pvaList["CL Email"][i],
"clPassword": pvaList["CL Password"][i],
"State": pvaList["State"][i],
"City": pvaList["City"][i],
"Zip": pvaList["Zip"][i],
"Email": pvaList["Email"][i],
"Password": pvaList["Password"][i],
"Port": pvaList["Port"][i],
"Imap": pvaList["Imap"][i],
"Link": pvaList[_temp][i],
"title": messageList["Title"][i],
"message": messageList["Message"][i]
}
var.info.append(temp.copy())
var.infoQ.put(temp.copy())
print(var.info[0].keys())