|
5 | 5 | import random |
6 | 6 | import base64 |
7 | 7 | import hashlib |
8 | | -import requests |
9 | 8 | from typing import Union, List |
10 | 9 | from functools import reduce |
11 | 10 | from .cubic_curve import Cubic |
@@ -56,10 +55,10 @@ async def get_indices(self, home_page_response, session, headers): |
56 | 55 | key_byte_indices = list(map(int, key_byte_indices)) |
57 | 56 | return key_byte_indices[0], key_byte_indices[1:] |
58 | 57 |
|
59 | | - def validate_response(self, response: Union[bs4.BeautifulSoup, requests.models.Response]): |
60 | | - if not isinstance(response, (bs4.BeautifulSoup, requests.models.Response)): |
| 58 | + def validate_response(self, response: bs4.BeautifulSoup): |
| 59 | + if not isinstance(response, bs4.BeautifulSoup): |
61 | 60 | raise Exception("invalid response") |
62 | | - return response if isinstance(response, bs4.BeautifulSoup) else bs4.BeautifulSoup(response.content, 'lxml') |
| 61 | + return response |
63 | 62 |
|
64 | 63 | def get_key(self, response=None): |
65 | 64 | response = self.validate_response(response) or self.home_page_response |
@@ -158,7 +157,3 @@ def generate_transaction_id(self, method: str, path: str, response=None, key=Non |
158 | 157 | out = bytearray( |
159 | 158 | [random_num, *[item ^ random_num for item in bytes_arr]]) |
160 | 159 | return base64_encode(out).strip("=") |
161 | | - |
162 | | - |
163 | | -if __name__ == "__main__": |
164 | | - pass |
0 commit comments