Hashir Kashif commited on
Commit
366abde
·
1 Parent(s): 2848f26
Files changed (1) hide show
  1. app.py +22 -4
app.py CHANGED
@@ -95,9 +95,6 @@ def getNetflixInfo(cookiefile):
95
  r = requests.get("https://www.netflix.com/BillingActivity",
96
  cookies=cookies)
97
  print(r.url)
98
- f = open("netflixWebCode.txt", "w")
99
- f.write(str(r.content))
100
- f.close()
101
  if "login" in r.url:
102
  print("Login Page")
103
  os.remove(cookiefile)
@@ -163,13 +160,26 @@ def testTask():
163
  getNetflixInfo("./cookie.txt")
164
  os.chdir("../")
165
 
 
 
 
 
 
 
 
 
 
 
 
 
 
166
  app = Flask(__name__)
167
 
168
 
169
  @app.route('/', defaults={'req_path': ''})
170
  @app.route('/<path:req_path>')
171
  def dir_listing(req_path):
172
- BASE_DIR = './' #/var/task/api/Membership
173
  # Joining the base and the requested path
174
  abs_path = os.path.join(BASE_DIR, req_path)
175
  abs_path = unquote(abs_path)
@@ -209,6 +219,14 @@ def test():
209
  # mainTask()
210
  return 'Hello from Flask! test'
211
 
 
 
 
 
 
 
 
 
212
 
213
  ppath = "/"
214
 
 
95
  r = requests.get("https://www.netflix.com/BillingActivity",
96
  cookies=cookies)
97
  print(r.url)
 
 
 
98
  if "login" in r.url:
99
  print("Login Page")
100
  os.remove(cookiefile)
 
160
  getNetflixInfo("./cookie.txt")
161
  os.chdir("../")
162
 
163
+ def backupTask():
164
+ archived = shutil.make_archive('./backup', 'zip', './Membership')
165
+ header = {
166
+ 'authorization': os.environ['DISCORD_CODE'],
167
+ }
168
+ files = {
169
+ "file" : ("./backup.zip", open("./backup.zip", 'rb'))
170
+ }
171
+
172
+ channel_id = "1193267345079156746"
173
+
174
+ r = requests.post(f"https://discord.com/api/v9/channels/{channel_id}/messages", headers=header, files=files)
175
+
176
  app = Flask(__name__)
177
 
178
 
179
  @app.route('/', defaults={'req_path': ''})
180
  @app.route('/<path:req_path>')
181
  def dir_listing(req_path):
182
+ BASE_DIR = './Membership' #/var/task/api/Membership
183
  # Joining the base and the requested path
184
  abs_path = os.path.join(BASE_DIR, req_path)
185
  abs_path = unquote(abs_path)
 
219
  # mainTask()
220
  return 'Hello from Flask! test'
221
 
222
+ @app.route('/backup')
223
+ def backup():
224
+ thr = Thread(target=backupTask)
225
+ # thr = Thread(target=mainTask)
226
+ thr.start()
227
+ # mainTask()
228
+ return 'Backup Started'
229
+
230
 
231
  ppath = "/"
232