diff --git a/bot/bot.py b/bot/bot.py index 230c424..a1dc075 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -60,14 +60,15 @@ def whatsapp_login(driver): while True: response = requests.get(f"{REQUEST_URL}/abresesion.php") logging.info("Checking if someones there...") - if response.content == "SI": + if "SI" in response.content: logging.info("Someones there! Getting QR code...") driver.get("https://web.whatsapp.com/") time.sleep(SLEEP_LONG) driver.save_screenshot(location) with open(location, "rb") as qrcode: - encoded_string = base64.b64encode(qrcode.read()) - requests.post(f"{REQUEST_URL}/qrsesion.php", data=encoded_string) + files = {'qr_image': qrcode} + #encoded_string = base64.b64encode(qrcode.read()) + requests.post(f"{REQUEST_URL}/qrsesion.php", files=files) logging.info("QR code sent through POST request! Waiting for user to scan it") time.sleep(SLEEP_QRCODE) driver.get("https://web.whatsapp.com/")