title: Trigger GitLab Build with Python Requests
body: <p>I'm trying to trigger a GitLab build using Python Requests.  Normally one can kick off a build with a <code>curl</code> command.</p>
  
  <p>Example curl command:</p>
  
  <pre><code>curl -X POST \
    -F token=TOKEN \
    -F ref=master \
    -F "variables[UPLOAD_TO_S3]=true" \
    https://gitlab.example.com/api/v4/projects/9/trigger/pipeline
  </code></pre>
  
  <p>I can get this working using the <code>sh</code> module but I'd prefer using <code>requests</code>.  I've tried variations with the following:</p>
  
  <pre><code>data = {
      'token': token,
      'ref': master,
      'variables[UPLOAD_TO_S3]': str(uploadS3),
  }
  
  headers = {'Content-Type': 'application/json'}
  result = requests.post(_trigger_url, headers=headers, json=data)
  </code></pre>
  
  <p>I tried with and without the <code>headers</code> param.  I've also tried passing the <code>data</code> dict using <code>params</code>, <code>json</code>, <code>files</code>, and <code>data</code>. All keep coming back with 400 or 404 errors.  Any suggestions? </p>