title: How to upload a file to the file.io website using Python
body: <p>I am trying to send a <a href="https://en.wikipedia.org/wiki/POST_%28HTTP%29" rel="nofollow noreferrer">POST</a> request to the <em>file.io</em> website to upload a file from my Python script and I want to get the link for that file. Here is my code:</p>
  <pre><code>import requests
  
  url = 'https://file.io/post'
  files = {&quot;file&quot;: open(&quot;myimage.jpg&quot;, &quot;rb&quot;)}
  response = requests.post(url, files=files)
  link = response.json()['link']
  
  print(link)
  
  </code></pre>
  <p>When I print the response code, I get 200. Everything seems OK, but I can’t get the link of the uploaded file. I get an error.
  I want to be able to upload a file I specify and get back a link using my little Python script.</p>