MCPcopy Create free account
hub / github.com/THUDM/GLM / http_get

Function http_get

data_utils/file_utils.py:163–172  ·  view source on GitHub ↗
(url, temp_file)

Source from the content-addressed store, hash-verified

161
162
163def http_get(url, temp_file):
164 req = requests.get(url, stream=True)
165 content_length = req.headers.get('Content-Length')
166 total = int(content_length) if content_length is not None else None
167 progress = tqdm(unit="B", total=total)
168 for chunk in req.iter_content(chunk_size=1024):
169 if chunk: # filter out keep-alive new chunks
170 progress.update(len(chunk))
171 temp_file.write(chunk)
172 progress.close()
173
174
175def get_from_cache(url, cache_dir=None):

Callers 1

get_from_cacheFunction · 0.85

Calls 2

closeMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected