Changed SI check. Changed qr code image sending
This commit is contained in:
@@ -60,14 +60,15 @@ def whatsapp_login(driver):
|
|||||||
while True:
|
while True:
|
||||||
response = requests.get(f"{REQUEST_URL}/abresesion.php")
|
response = requests.get(f"{REQUEST_URL}/abresesion.php")
|
||||||
logging.info("Checking if someones there...")
|
logging.info("Checking if someones there...")
|
||||||
if response.content == "SI":
|
if "SI" in response.content:
|
||||||
logging.info("Someones there! Getting QR code...")
|
logging.info("Someones there! Getting QR code...")
|
||||||
driver.get("https://web.whatsapp.com/")
|
driver.get("https://web.whatsapp.com/")
|
||||||
time.sleep(SLEEP_LONG)
|
time.sleep(SLEEP_LONG)
|
||||||
driver.save_screenshot(location)
|
driver.save_screenshot(location)
|
||||||
with open(location, "rb") as qrcode:
|
with open(location, "rb") as qrcode:
|
||||||
encoded_string = base64.b64encode(qrcode.read())
|
files = {'qr_image': qrcode}
|
||||||
requests.post(f"{REQUEST_URL}/qrsesion.php", data=encoded_string)
|
#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")
|
logging.info("QR code sent through POST request! Waiting for user to scan it")
|
||||||
time.sleep(SLEEP_QRCODE)
|
time.sleep(SLEEP_QRCODE)
|
||||||
driver.get("https://web.whatsapp.com/")
|
driver.get("https://web.whatsapp.com/")
|
||||||
|
|||||||
Reference in New Issue
Block a user