我想通过urllib python3.6库发送图像数据。 目前,我在请求库的帮助下实现了Python2.7。在
在这段代码中,Id有一种方法可以用urllib替换requests lib。在
import argparse
import io
import os
import sys
import base64
import requests
def read_file_bytestream(image_path):
data = open(image_path, 'rb').read()
return data
if __name__== "__main__":
data=read_file_bytestream("testimg.png")
requests.put("http.//0.0.0.0:8080", files={'image': data})
这里有一种方法,基本上是从文档中提取的:
相关问题 更多 >
编程相关推荐