如题,我爬到类似如下的url,请问如何转成base64的图片编码
88.88.88.888:88888/aaaa/show/displayPhoto?tbName=B_PIC&pkName=P_KEY&pkValue=888&fdName=PIC
如题,我爬到类似如下的url,请问如何转成base64的图片编码
88.88.88.888:88888/aaaa/show/displayPhoto?tbName=B_PIC&pkName=P_KEY&pkValue=888&fdName=PIC
import requests
import base64
url=''
response = requests.get(url, allow_redirects=False)
base64_bytes = base64.b64encode(response.content)
str = str(base64_bytes,'utf-8')
src ='data:image/png;base64,' + str
print(src)