Skip to content

Commit

Permalink
fix httpx
Browse files Browse the repository at this point in the history
  • Loading branch information
datawhores committed Aug 21, 2024
1 parent 0f0681e commit d2be49c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ async def _alt_download_downloader(self, item, c, ele):
).init()
item["path"] = placeholderObj.tempfilepath
item["total"] = None

async for _ in download_retry():
with _:
try:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ async def _download_fileobject_writer_streamer(
async for chunk in r.iter_chunked(chunk_size):
await fileobject.write(chunk)
send_chunk_msg(ele, total, tempholderObj)
pass
except Exception as E:
raise E
finally:
Expand Down
13 changes: 4 additions & 9 deletions ofscraper/classes/sessionmanager/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,10 @@ async def factoryasync(self, input):

def chunk_with_limit(self, funct):
async def wrapper(*args, **kwargs):
while True:
try:
chunk = await anext(funct(*args, **kwargs))
size = len(chunk)
await self.get_token(size)
yield chunk
except StopAsyncIteration:
break

async for chunk in funct(*args, **kwargs):
size = len(chunk)
await self.get_token(size)
yield chunk
return wrapper

async def get_token(self, size):
Expand Down

0 comments on commit d2be49c

Please sign in to comment.