title: How to send a Starlette FormData data structure to a FastAPI endpoint via python request library
body: <p>My system architecture currently sends a form data blob from the frontend to the backend, both hosted on localhost on different ports. The form data is recieved in the backend via the FastAPI library as shown.</p>
  <pre><code>@app.post('/avatar/request')
  async def get_avatar_request(request: Request, Authorize: AuthJWT = Depends()):
      form = await request.form()
      return run_function_in_jwt_wrapper(get_avatar_output, form, Authorize, False)
  </code></pre>
  <p>Currently, I am trying to relay the form data unmodified to another FASTApi end point from the backend using the request library, as follows:</p>
  <pre><code>response = requests.post(models_config[&quot;avatar_api&quot;], data = form_data, headers = {&quot;response-type&quot;: &quot;blob&quot;})
  </code></pre>
  <p>While the destination endpoint does receive the Form Data, it seemed to not have parsed the UploadFile component properly. Instead of getting the corresponding starlette UploadFile data structure, I instead receive the string of the classname, as shown in this error message:</p>
  <pre><code>FormData([('avatarFile', '&lt;starlette.datastructures.UploadFile object at 0x7f8d25468550&gt;'), ('avatarFileType', 'jpeg'), ('background', 'From Image'), ('voice', 'en-US-Wavenet-B'), ('transcriptKind', 'text'), ('translateToLanguage', 'No translation'), ('transcriptText', 'do')])
  </code></pre>
  <p>How should I handle this problem?</p>