mirror of
https://github.com/Noettore/lagomareGateKeeperBot.git
synced 2025-10-15 03:26:40 +02:00
Refactor and start implementing inline keyboards
This commit is contained in:
19
avconnect.py
19
avconnect.py
@@ -1,5 +1,4 @@
|
||||
import requests
|
||||
import pprint
|
||||
from fake_useragent import UserAgent
|
||||
from commons import Credential
|
||||
|
||||
@@ -15,12 +14,9 @@ class AVConnectAPI:
|
||||
|
||||
def _authenticate(self) -> bool:
|
||||
login_url = f"{self._BASE_URL}/loginone.php"
|
||||
headers = {
|
||||
"Content-Type": "application/x-www-form-urlencoded"
|
||||
}
|
||||
headers = {"Content-Type": "application/x-www-form-urlencoded"}
|
||||
payload = f"userid={self._username}&password={self._password}&entra=Login"
|
||||
response = self._session.post(login_url, data=payload, headers=headers)
|
||||
|
||||
if response.ok and "PHPSESSID" in self._session.cookies:
|
||||
self._authenticated = True
|
||||
return True
|
||||
@@ -29,18 +25,13 @@ class AVConnectAPI:
|
||||
def exec_gate_macro(self, id_macro) -> bool:
|
||||
if not self._authenticated and not self._authenticate():
|
||||
raise Exception("Authentication failed.")
|
||||
|
||||
exec_url = f"{self._BASE_URL}/exemacrocom.php"
|
||||
headers = {
|
||||
"User-Agent": self._ua,
|
||||
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
|
||||
}
|
||||
payload = f"idmacrocom={id_macro}&nome=16"
|
||||
|
||||
response = self._session.prepare_request(requests.Request("POST", exec_url, data=payload, headers=headers))
|
||||
pprint.pprint(response.headers)
|
||||
return True
|
||||
#response = self._session.post(exec_url, data=payload, headers=headers)
|
||||
#if response.ok:
|
||||
# return True
|
||||
#return False
|
||||
# Uncomment for real request:
|
||||
# response = self._session.post(exec_url, data=payload, headers=headers)
|
||||
# return response.ok
|
||||
return True # For testing
|
Reference in New Issue
Block a user