Updated client/client.py

This commit is contained in:
mirai 2022-12-01 10:18:14 +03:00
parent 2ffd0443ce
commit 776ca81577

View File

@ -82,7 +82,6 @@ class Client:
def _key_request(self) -> None: def _key_request(self) -> None:
with open('private.pem', 'rb') as f: with open('private.pem', 'rb') as f:
self.privkey = rsa.PrivateKey.load_pkcs1(f.read()) self.privkey = rsa.PrivateKey.load_pkcs1(f.read())
with open("public.pem", 'rb') as f: with open("public.pem", 'rb') as f:
with requests.get(self.key_url, data={"pubkey": f.read(), "username": self.username}, stream=True) as r: with requests.get(self.key_url, data={"pubkey": f.read(), "username": self.username}, stream=True) as r:
message = r.raw.read(999) message = r.raw.read(999)
@ -103,6 +102,9 @@ class Client:
def __call__(self): def __call__(self):
# Running two threads,
# One for sending info
# Second one for updating info
self._validate_keys() self._validate_keys()
threads = [ threads = [
threading.Thread(target=self.send_info), threading.Thread(target=self.send_info),