title: Sending payload for GET request in python
body: <p>To filter the output, I can send a JSON to the API, like :</p>
  
  <pre><code>curl -X GET https://api.mysite.com/user \ 
    -H "Authorization: XXXXX" \ 
    -H "Content-Type: application/json"
    -d '{
      "q": {
        "name": {
            "eq": "0aslam0"
         }          
      }
    }'
  </code></pre>
  
  <p>The above works just fine. I am trying to send the same via python code using <code>requests</code> library.I tried the following code: </p>
  
  <pre><code>r = requests.get(url, headers=my_headers, params=payload)
  </code></pre>
  
  <p>where</p>
  
  <pre><code>url = "https://api.mysite.com/user"
  my_headers = {
      'Authorization': 'XXXXX',
      'Content-Type': 'application/json',
      'Accept': 'application/json',
  }
  data = { 
      "q": {
          "name": {
              "eq": "0aslam0"
          }
      }
  }
  payload = json.dumps(data)
  </code></pre>
  
  <p>but <code>r.text</code> contains the output of a normal GET without applying filter. I logged the request, and saw that I was getting a redirect <code>301</code>. I don't understand my mistake.</p>
  
  <p><strong>EDIT 1</strong></p>
  
  <p>I changed the code to : </p>
  
  <pre><code>r = requests.get(url, headers=my_headers, json=payload)
  </code></pre>
  
  <p>@Martijn was right. Using <code>params</code> was wrong. But the above also didn't succeed. I also added a header <code>'User-Agent': 'curl/7.40.0'</code>, to see if that could work. No luck there as well.</p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>The API documentation says, filtering can be done by another method. Changing the url into: </p>
  
  <pre><code>GET /user?q%5Bname%5D%5Beq%5D=0aslam0 HTTP/1.1
  </code></pre>
  
  <p>It is HTML encoded. So I tried, to format my url into such a format and avoid sending the payload, like:</p>
  
  <pre><code>r = requests.get(url, headers=my_headers)
  </code></pre>
  
  <p>And it works! So at least now I have a solution to my problem. But the question on how to send the payload (the method discussed above) for a GET request, still remains.</p>