MCPcopy Create free account
hub / github.com/modelscope/modelscope / encode_url_to_base64

Function encode_url_to_base64

modelscope/utils/service_utils.py:115–120  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

113
114
115def encode_url_to_base64(url):
116 encoded_string = base64.b64encode(requests.get(url).content)
117 base64_str = str(encoded_string, 'utf-8')
118 mimetype = get_mimetype(url)
119 return ('data:' + (mimetype if mimetype is not None else '') + ';base64,'
120 + base64_str)
121
122
123def encode_file_to_base64(f):

Callers 1

Calls 2

get_mimetypeFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…