0

Given a flask server, I wish to mimic an HTTP request to it from another python file, it it possible? I.e Given the following python "client" application:

def send_img_to_flask(img_path,server_ip):
    request = Request(ip=server_ip,POST_parameters={'file':img_path})

And respectively the server endpoint will:

@app.route('/uploader', methods = ['GET', 'POST'])
def upload_file():
   if request.method == 'POST':
      f = request.files['file']
      f.save(secure_filename(f.filename))
      return 'file uploaded successfully'
DsCpp
  • 2,259
  • 3
  • 18
  • 46

0 Answers0