Skip to content

Commit

Permalink
Fix response chain mismatching (1.17.2)
Browse files Browse the repository at this point in the history
  • Loading branch information
cevoj35 committed Jun 9, 2023
1 parent f79cba4 commit e6825fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions FmhyChecker.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ from typing import Union


__author__ = "cevoj"
__version__ = "1.17.1"
__version__ = "1.17.2"


# disable ssl warnings
Expand Down Expand Up @@ -61,8 +61,8 @@ class StatusResp:


class LinkTest:
chunk_size = 50 # number of links to test at once
statusapi_url = b64decode('aHR0cHM6Ly9iYWNrZW5kLmh0dHBzdGF0dXMuaW8vYXBp').decode()
chunk_size = 50 # number of links to test at once
statusapi_url = b64decode('aHR0cHM6Ly9iYWNrZW5kLmh0dHBzdGF0dXMuaW8vYXBp').decode()
statusapi_headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:108.0) Gecko/20100101 Firefox/108.0',
'Accept': 'application/json, text/plain, */*',
Expand Down Expand Up @@ -104,21 +104,21 @@ class LinkTest:
grequests.head(url, headers=headers.generate(), timeout=10, allow_redirects=True, verify=False)
for url in urls
]
resps = grequests.imap(reqs, size=len(reqs), exception_handler=lambda _, e: e)
for (item, url, resp) in zip(items, urls, resps):
resps = grequests.imap_enumerated(reqs, size=len(reqs), exception_handler=lambda _, e: e)
for index, resp in resps:
if not resp:
err = 'Connection Failed'
elif isinstance(resp, Exception):
err = LinkTest.error_names.get(resp.__class__, resp.__class__.__name__)
else:
err = None
statusresp = StatusResp(
url = url,
url = urls[index],
status_code = 0 if err else resp.status_code,
reason = err or status_codes[resp.status_code],
history = [] if err else (*resp.history, resp),
)
callback(item, statusresp)
callback(items[index], statusresp)
dist_cnxns.get() # release next in queue

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ darkdetect==0.8.0
fake-headers==1.0.2
gevent==22.10.2
greenlet==2.0.2
grequests==0.6.0
grequests==0.7.0
html5lib==1.1
idna==3.4
msvc-runtime==14.34.31931; sys_platform == 'win32'
Expand Down

0 comments on commit e6825fe

Please sign in to comment.