hashir672 commited on
Commit
61bc7ee
·
verified ·
1 Parent(s): 8c8ebef

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -220,9 +220,8 @@ def getNetflixInfoWithApi(cookiefile):
220
  if "login" in r.url:
221
  print("Login Page")
222
  os.remove(cookiefile)
223
- ftp,ssh_client = sftp_connect()
224
- ftp.remove("./domains/hashir672.serv00.net/public_html/Membership/"+cookiefile)
225
- ssh_client.close()
226
  return "Not working"
227
  else:
228
  soup = BeautifulSoup(r.content, "html.parser")
@@ -266,15 +265,15 @@ def getNetflixInfoWithApi(cookiefile):
266
  f = open("./Membership/error.txt", "a")
267
  f.write(str(e) + "\n\n")
268
  f.close()
269
- print("\n Moving in noMember")
270
- S = 10
271
- ran = ''.join(
272
- random.choices(string.ascii_uppercase + string.digits, k=S))
273
- shutil.move(cookiefile, './NoMembership/NoMember' + str(ran) + ".txt")
274
  return "Error occured"
275
  else:
276
  os.remove(cookiefile)
277
  print("cookie removed")
 
 
278
  return "invalid cookie"
279
 
280
 
@@ -321,6 +320,10 @@ def sftp_connect():
321
  ssh_client.connect(hostname=host,port=port,username=username,password=password)
322
  ftp = ssh_client.open_sftp()
323
  return ftp,ssh_client
 
 
 
 
324
 
325
  app = Flask(__name__)
326
 
 
220
  if "login" in r.url:
221
  print("Login Page")
222
  os.remove(cookiefile)
223
+ thr = Thread(target=removeCookieFromServer,args=(cookiefile))
224
+ thr.start()
 
225
  return "Not working"
226
  else:
227
  soup = BeautifulSoup(r.content, "html.parser")
 
265
  f = open("./Membership/error.txt", "a")
266
  f.write(str(e) + "\n\n")
267
  f.close()
268
+ os.remove(cookiefile)
269
+ thr = Thread(target=removeCookieFromServer,args=(cookiefile))
270
+ thr.start()
 
 
271
  return "Error occured"
272
  else:
273
  os.remove(cookiefile)
274
  print("cookie removed")
275
+ thr = Thread(target=removeCookieFromServer,args=(cookiefile))
276
+ thr.start()
277
  return "invalid cookie"
278
 
279
 
 
320
  ssh_client.connect(hostname=host,port=port,username=username,password=password)
321
  ftp = ssh_client.open_sftp()
322
  return ftp,ssh_client
323
+ def removeCookieFromServer(cookiefile):
324
+ ftp,ssh_client = sftp_connect()
325
+ ftp.remove("./domains/hashir672.serv00.net/public_html/Membership/"+cookiefile)
326
+ ssh_client.close()
327
 
328
  app = Flask(__name__)
329