From 1fb4dd9b7bf6167a128a5588589bff27fb0f9b1f Mon Sep 17 00:00:00 2001 From: 91c0e59d-6161-45ab-8aa4-2371574db28f <91c0e59d-6161-45ab-8aa4-2371574db28f@bankofchina.com> Date: Wed, 5 Feb 2025 16:05:26 +0800 Subject: [PATCH] feat: use httpx instead of urllib3 --- sdgb/authlite.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/sdgb/authlite.py b/sdgb/authlite.py index bce9fc2..81b3b28 100644 --- a/sdgb/authlite.py +++ b/sdgb/authlite.py @@ -2,7 +2,7 @@ import dataclasses from Crypto.Cipher import AES from Crypto.Util.Padding import pad import base64 -import urllib3 +import httpx def enc(key, iv, data): cipher = AES.new(key, AES.MODE_CBC, iv) @@ -25,17 +25,15 @@ def hello(): header = bytes.fromhex('00000000000000000000000000000000') bytes_data = pad(header + content, 16) encrypted = enc(key, iv, bytes_data) - http = urllib3.PoolManager() - r = http.request( - 'POST', + r = httpx.post( 'http://at.sys-allnet.cn/net/delivery/instruction', - body=encrypted, - headers={ + data = encrypted, + headers = { 'User-Agent': ua, 'Pragma': 'DFI' } ) - resp_data = r.data + resp_data = r.content decrypted = dec(key, resp_data[:16], resp_data) decrypted_bytes = decrypted[16:] decrypted_str = decrypted_bytes.decode('UTF-8')