Skip to content

Commit 89cdbf8

Browse files
committed
update scripts
1 parent b863180 commit 89cdbf8

File tree

4 files changed

+75
-41
lines changed

4 files changed

+75
-41
lines changed

main.py

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ def updateData(self):
156156
if len(db.viewCommand()) == 0:
157157
for dt in dbold.viewCommand():
158158
db.insertCommand(url=dt[18], datewanted=dt[2], timewanted=dt[3], hoursba=dt[4], seats=dt[5],reservation=dt[6],rundate=dt[7],runtime=dt[8], runnow=dt[9],account=dt[10], nonstop=dt[11], duration=dt[12],proxy=dt[13],retry=dt[14],minidle=dt[15],maxidle=dt[16])
159+
159160
messagebox.showinfo(title='Info', message='the Data has updated...')
160161

161162
class MainFrame(ttk.Frame):
@@ -1114,21 +1115,25 @@ def __init__(self, window) -> None:
11141115
titleLabel = TitleLabel(self, text="Proxy Form")
11151116
namelabel = Label(self, text="Name: ")
11161117
self.name = StringVar()
1117-
nameentry = Entry(self, width=60, textvariable=self.name)
1118-
httplabel = Label(self, text="Http: ")
1119-
self.http = StringVar()
1120-
httpentry = Entry(self, width=60, textvariable=self.http)
1121-
httpslabel = Label(self, text="Https: ")
1122-
self.https = StringVar()
1123-
httpsentry = Entry(self, width=60, textvariable=self.https)
1124-
1118+
nameentry = Entry(self, width=133, textvariable=self.name)
1119+
httplabel = Label(self, text="Proxies: ")
1120+
# self.http = StringVar()
1121+
# httpentry = Entry(self, width=60, textvariable=self.http)
1122+
self.httpentry = Text(self, width=100, height=15)
1123+
# self.httpentry.insert()
1124+
1125+
# httpslabel = Label(self, text="Https: ")
1126+
# self.https = StringVar()
1127+
# httpsentry = Entry(self, width=60, textvariable=self.https)
11251128

11261129
style = ttk.Style()
11271130
# style.theme_use("clam")
11281131
style.configure("Fancy.TButton", font=("Cooper Black", 12), foreground="blue", background="green")
11291132

11301133
closeButton = CloseButton(self)
1131-
saveButton = ttk.Button(self, text='Insert', command = lambda:self.savelist(name=nameentry, http=httpentry, https=httpsentry), style="Fancy.TButton")
1134+
# saveButton = ttk.Button(self, text='Insert', command = lambda:self.savelist(name=nameentry, http=httpentry, https=httpsentry), style="Fancy.TButton")
1135+
saveButton = ttk.Button(self, text='Insert', command = lambda:self.savelist(name=nameentry, http=self.httpentry), style="Fancy.TButton")
1136+
11321137
removeButton = ttk.Button(self, text='Delete', command=self.removeData, style="Fancy.TButton")
11331138
updateButton = ttk.Button(self, text='Update', command=self.updateData, style="Fancy.TButton")
11341139

@@ -1137,9 +1142,10 @@ def __init__(self, window) -> None:
11371142
namelabel.grid(column = 0, row = 2, sticky=(W,N))
11381143
nameentry.grid(column = 0, row = 2, sticky=(E,N), padx=30)
11391144
httplabel.grid(column = 0, row = 3, sticky=(W,N))
1140-
httpentry.grid(column = 0, row = 3, sticky=(E,N), padx=30)
1141-
httpslabel.grid(column = 0, row = 4, sticky=(W,N))
1142-
httpsentry.grid(column = 0, row = 4, sticky=(E,N), padx=30)
1145+
self.httpentry.grid(column = 0, row = 3, sticky=(E,N), padx=30)
1146+
# httpslabel.grid(column = 0, row = 4, sticky=(W,N))
1147+
# httpsentry.grid(column = 0, row = 4, sticky=(E,N), padx=30)
1148+
# proxyentry.grid(column = 0, row = 4, sticky=(E,N), padx=30)
11431149

11441150
saveButton.grid(column = 0, row = 5, sticky = (N, E), padx=30)
11451151
updateButton.grid(column = 0, row = 5, sticky = (N))
@@ -1152,7 +1158,9 @@ def __init__(self, window) -> None:
11521158

11531159

11541160
def savelist(self, **kwargs):
1155-
db.insertProxy(name=kwargs['name'].get(),http=kwargs['http'].get(), https=kwargs['https'].get())
1161+
# db.insertProxy(name=kwargs['name'].get(),http=kwargs['http'].get(), https=kwargs['https'].get())
1162+
db.insertProxy(name=kwargs['name'].get(),http=kwargs['http'].get("1.0",END), https='')
1163+
11561164
self.viewData()
11571165
messagebox.showinfo("Message box","Proxy list Saved")
11581166
self.resetForm()
@@ -1184,15 +1192,16 @@ def updateData(self):
11841192
if self.chosenRow == None:
11851193
messagebox.showerror("Error!", "Please Choose a Proxy Record to Update!")
11861194
return
1187-
db.updateProxy(comid=self.chosenRow[0], name=self.name.get(), http=self.http.get(), https=self.https.get())
1195+
db.updateProxy(comid=self.chosenRow[0], name=self.name.get(), http=self.httpentry.get("1.0", END), https='')
11881196
self.viewData()
11891197
messagebox.showinfo("Info", "Proxy Updates..")
11901198
self.resetForm()
11911199

11921200
def resetForm(self):
11931201
self.name.set("")
1194-
self.http.set("")
1195-
self.https.set("")
1202+
# self.http.set("")
1203+
# self.https.set("")
1204+
self.httpentry.delete("1.0", END)
11961205

11971206
def tableOutputFrame(self):
11981207
style = ttk.Style()
@@ -1204,9 +1213,9 @@ def tableOutputFrame(self):
12041213
self.out.heading("2", text="Name")
12051214
self.out.column("2", width=100, stretch="yes")
12061215
self.out.heading("3", text="HTTP")
1207-
self.out.column("3", width=100, stretch="yes")
1216+
self.out.column("3", width=200, stretch="yes")
12081217
self.out.heading("4", text="HTTPS")
1209-
self.out.column("4", width=100, stretch="yes")
1218+
self.out.column("4", width=0, stretch="no")
12101219

12111220
self.out['show'] = 'headings'
12121221
self.out.bind("<ButtonRelease-1>", self.getData)
@@ -1221,8 +1230,11 @@ def getData(self, event):
12211230
self.selectedData = self.out.item(self.selectedRow)
12221231
self.chosenRow = self.selectedData["values"]
12231232
self.name.set(self.chosenRow[1])
1224-
self.http.set(self.chosenRow[2])
1225-
self.https.set(self.chosenRow[3])
1233+
# self.http.set(self.chosenRow[2])
1234+
self.httpentry.delete("1.0", END)
1235+
self.httpentry.insert("1.0", self.chosenRow[2])
1236+
1237+
# self.https.set(self.chosenRow[3])
12261238

12271239
except IndexError as error:
12281240
pass
@@ -1417,6 +1429,7 @@ def showLog(self):
14171429
messagebox.showerror("Error!", "Please Choose a Bot Check Availability to show the Log File!")
14181430
return
14191431
self.viewCheckBooking()
1432+
breakpoint()
14201433
logfile = f"logs/checkbooking_{self.chosenRow[0]}.log"
14211434
if Path(logfile).exists():
14221435
Popen(["notepad.exe", logfile])

modules/resy_bot2/api_access.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131

3232
def build_session(config: ResyConfig) -> Session:
33-
3433
session = Session()
3534
headers = {
3635
"Authorization": config.get_authorization(),
@@ -51,7 +50,6 @@ def build_session(config: ResyConfig) -> Session:
5150
}
5251
session.proxies.update(proxies)
5352
logger.info("Proxy Updated")
54-
5553
return session
5654

5755

modules/resybotcheckbooking1.py

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
from database import Database
2222

2323
db = Database("db.sqlite3")
24-
2524
current = os.path.dirname(os.path.realpath(__file__))
2625
parent = os.path.dirname(current)
2726
sys.path.append(parent)
2827
from settings import CLOSE_MESSAGE, CONTINUE_MESSAGE, TRY_MESSAGE, MIN_IDLE_TIME, MAX_IDLE_TIME
2928

29+
3030
logger = logging.getLogger(__name__)
3131
logger.setLevel("INFO")
3232

@@ -114,7 +114,7 @@ def main():
114114
hoursba = data[7]
115115
breservation = data[8]
116116
nonstop = data[9]
117-
proxy = data[10]
117+
proxyname = data[10]
118118
minidle = data[11]
119119
maxidle = data[12]
120120
retsecs = data[13]
@@ -130,25 +130,40 @@ def main():
130130
api_key = file.read()
131131
https_proxy = ''
132132
http_proxy = ''
133-
if proxy != '<Not Set>':
134-
proxy = db.getProxy(proxy)
135-
http_proxy = proxy[2]
136-
https_proxy = proxy[3]
133+
proxies = []
134+
if proxyname != '<Not Set>':
135+
proxy = db.getProxy(proxyname)
136+
proxies = proxy[2].split("\n")
137+
http_proxy = proxies[0]
138+
https_proxy = proxies[0]
137139

138140
resy_config = {"api_key": api_key, "token": '', "payment_method_id": 999999, "email":'', "password":'', "http_proxy": http_proxy, "https_proxy": https_proxy, "retry_count": 1, "seconds_retry": float(retsecs)}
139141
venue_id = get_venue_id(resy_config=resy_config, urladdress=url)
140142

141143
accountdata = db.getAccount(email=account)
142-
# breakpoint()
143144
password = accountdata[2]
144145
token = accountdata[3]
145146
api_key = accountdata[4]
146147
payment_method_id = accountdata[5]
147-
resy_config_booking = {"api_key": api_key, "token": token, "payment_method_id": payment_method_id, "email":account, "password":password, "http_proxy": http_proxy, "https_proxy": https_proxy, "retry_count": 1, "seconds_retry": float(retsecs)}
148+
resy_config_booking = {"api_key": api_key, "token": token, "payment_method_id": payment_method_id, "email":account, "password":password, "http_proxy": http_proxy, "https_proxy": https_proxy, "retry_count": 3, "seconds_retry": float(retsecs)}
148149
strdateyesterday = datetime.strftime(datetime.now()-timedelta(days=1), '%Y-%m-%d')
149-
flog = open(f"logs/checking_{id}.log", "w")
150+
flog = open(f"logs/checkbooking_{id}.log", "w")
151+
stoptime = datetime.now() + timedelta(minutes = 5)
152+
proxyidx = 1
150153
try:
151154
while True:
155+
if len(proxies) > 0:
156+
if datetime.now() >= stoptime:
157+
stoptime = datetime.now() + timedelta(minutes = 5)
158+
resy_config['http_proxy'] = proxies[proxyidx]
159+
resy_config['https_proxy'] = proxies[proxyidx]
160+
tmpstr = f"IP Proxy updated: {resy_config['http_proxy']}"
161+
print(tmpstr)
162+
flog.write(tmpstr + "\n")
163+
proxyidx += 1
164+
if proxyidx == len(proxies):
165+
proxyidx = 0
166+
152167
tmpstr = f"Restaurant URL: {url}"
153168
print(tmpstr)
154169
flog.write(tmpstr + "\n")

modules/resybotv5.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def main():
7474
parser.add_argument('-mx', '--maxidle', type=str,help="Max Idle Time")
7575

7676
args = parser.parse_args()
77+
breakpoint()
7778
if not args.url or not args.date or not args.time or not args.seats or not args.reservation or not args.chprofile or not args.rdate or not args.rtime or not args.rhours or not args.runnow or not args.nonstop or not args.duration or not args.duration or not args.proxy or not args.retry or not args.minidle or not args.maxidle:
7879
input(" ".join(['Please add complete parameters, ex: python resybotv4b -u [url] -d [dd-mm-yyyy] -t [h:m am/pm] -s [seats_count] -p [period] -r [reservation_type] -cp [chrome_profile] -rd [rdate] -rt [rtime] -rh [rhours] -rn [runnow] -ns [nonstop] -dr [duration] -up [proxy] -re [retry] -mn [minidle] -mx [maxidle]', CLOSE_MESSAGE]))
7980
sys.exit()
@@ -83,11 +84,12 @@ def main():
8384
token = profile[3]
8485
api_key = profile[4]
8586
payment_method_id = profile[5]
86-
file = open("profilelist.json", "r")
87-
profilelist = json.load(file)
88-
for profile in profilelist:
89-
if profile['email'] == args.chprofile:
90-
break
87+
# file = open("profilelist.json", "r")
88+
# profilelist = json.load(file)
89+
# for profile in profilelist:
90+
# if profile['email'] == args.chprofile:
91+
# break
92+
9193
myTable = PrettyTable(["KEY","VALUE"])
9294
myTable.align ="l"
9395
myTable.add_row(["Restaurant", args.url.split("/")[-1]])
@@ -128,12 +130,18 @@ def main():
128130
venue_id = response.json()['id']['resy']
129131
https_proxy = ''
130132
http_proxy = ''
131-
if args.proxy != '<Not Set>':
132-
proxy = db.getProxy(args.proxy)
133-
http_proxy = proxy[2]
134-
https_proxy = proxy[3]
133+
proxies = []
134+
if str(args.proxy) != '<Not Set>':
135+
proxy = db.getProxy(str(args.proxy))
136+
proxies = proxy[2].split("\n")
137+
http_proxy = proxies[0]
138+
https_proxy = proxies[0]
139+
140+
# if args.proxy != '<Not Set>':
141+
# proxy = db.getProxy(args.proxy)
142+
# http_proxy = proxy[2]
143+
# https_proxy = proxy[3]
135144
resy_config = {"api_key": api_key, "token": token, "payment_method_id":payment_method_id, "email":email, "password":password, "http_proxy":http_proxy, "https_proxy": https_proxy, "retry_count": int(args.retry), "seconds_retry": 0.5}
136-
137145
if args.reservation == '<Not Set>':
138146
reservation_type = None
139147
else:

0 commit comments

Comments
 (0)