Python
python展开代码import requests
def save_picture_and_get_url(pic_path: str):
    pic_name = pic_path.split('/')[-1]
    url = "http://10.10.90.88:8113/upload"
    with open(pic_path, 'rb') as f:
        files = {'file': f}
        data = {"bucketName": "algorithmgroupfiles",
                'inputDir': 'chengguan/',
                'persistLink': 'true'}
        res = requests.request(method="POST", url=url, data=data, files=files)
    return res.json()['data'][pic_name]  # 返回url
if __name__ == '__main__':
    name = "./testpicture/img1coj3.jpg"
    print(save_picture_and_get_url(name))


本文作者:Dong
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!