title: Python requests.post, cant use a file as "data" variable
body: <pre><code>    headers = {
      &quot;User-Agent&quot;: &quot;Mozilla/5.0&quot;,
      'accept': 'application/json',
      'Content-Type': 'application/json',
  }
  with open(&quot;jsonattempt.txt&quot;,&quot;r&quot;) as f:
      data = f.read()
      json_data = &quot;'&quot; + data + &quot;'&quot;
  response = requests.post('https://www.pathofexile.com/api/trade/search/Standard', headers=headers, data=json_data)
  print(response)
  </code></pre>
  <p>Generally, there is a curl request like this:</p>
  <pre><code>    curl -X 'POST' \
        'https://www.pathofexile.com/api/trade/search/Standard' \
        -H 'accept: application/json' \
        -H 'Content-Type: application/json' \
        -d '{
      &quot;query&quot;: {
          &quot;status&quot;: {
              &quot;option&quot;: &quot;online&quot;
          },
          &quot;type&quot;: &quot;Turquoise Amulet&quot;,
          &quot;stats&quot;: [
              {
                  &quot;type&quot;: &quot;and&quot;,
                  &quot;filters&quot;: [
                      {
                          &quot;id&quot;: &quot;pseudo.pseudo_total_mana&quot;,
                          &quot;value&quot;: {
                              &quot;min&quot;: 47,
                              &quot;max&quot;: 49
                          },
                          &quot;disabled&quot;: false
                      }
                  ]
              }
          ]
      },
      &quot;sort&quot;: {
          &quot;price&quot;: &quot;asc&quot;
      }
  }'
  </code></pre>
  <p>Which returns a bunch of unnecessary things.</p>
  <p>My json_data variable and jsonattempt.txt is the same as -d parameter, I add ' ' to start and to end:</p>
  <pre><code>{
      &quot;query&quot;: {
          &quot;status&quot;: {
              &quot;option&quot;: &quot;online&quot;
          },
          &quot;type&quot;: &quot;Turquoise Amulet&quot;,
          &quot;stats&quot;: [
              {
                  &quot;type&quot;: &quot;and&quot;,
                  &quot;filters&quot;: [
                      {
                          &quot;id&quot;: &quot;pseudo.pseudo_total_mana&quot;,
                          &quot;value&quot;: {
                              &quot;min&quot;: 47,
                              &quot;max&quot;: 49
                          },
                          &quot;disabled&quot;: false
                      }
                  ]
              }
          ]
      },
      &quot;sort&quot;: {
          &quot;price&quot;: &quot;asc&quot;
      }
  }
  </code></pre>
  <p>I convert curl request to python which is the code on the top, I add the data as json_data and yeet the post request but keep getting 400 Bad Request.</p>
  <p>Request 401 is Unauthorized AFAIK, so I dont need an OAuth2 key for this. How can I insert my json file appropiately to the request?</p>
  <p>(Same exact json works on <code>https://app.swaggerhub.com/apis-docs/Chuanhsing/poe/1.0.0#/Trade/get_api_trade_fetch__items_</code> I am just asking how to insert my json file to requests.post correctly.)</p>