title: boto3 signature doesn't match with S3
body: <p>I'm trying to make an upload from <code>Heroku</code> to <code>S3</code> using <code>boto3</code> but I keep getting the error <code>&lt;Error&gt;&lt;Code&gt;SignatureDoesNotMatch&lt;/Code&gt;&lt;Message&gt;The request signature we calculated does not match the signature you provided. Check your key and signing method.&lt;/Message&gt;</code>.  I've tried using a <code>pre-signed post</code> and a <code>pre-signed url</code> but the error persists.  The credentials that I'm providing to Heroku to make the request are my root AWSAccessKeyID and Secret key, so I shouldn't have issues with permissions.  I'm able to directly upload to S3 from my command line. </p>
  
  <p>Values returned after generating a pre-signed post:</p>
  
  <pre><code>{'fields': {'x-amz-signature': '26eff5417d0d11a25dd294b059a088e2be37a97f14713962f4240c9f4e33febb', 'x-amz-algorithm': 'AWS4-HMAC-SHA256', 'key': u'sound.m4a', 'x-amz-credential': u'&lt;AWSAccessID&gt;/20161011/us-east-1/s3/aws4_request', 'policy': u'eyJjb25kaXRpb25zIjogW3siYnVja2V0IjogImZ1dHVyZWZpbGVzIn0sIHsia2V5IjogInNvdW5kLm00YSJ9LCB7IngtYW16LWFsZ29yaXRobSI6ICJBV1M0LUhNQUMtU0hBMjU2In0sIHsieC1hbXotY3JlZGVudGlhbCI6ICJBS0lBSTdLRktCTkJTNEM0VktKQS8yMDE2MTAxMS91cy1lYXN0LTEvczMvYXdzNF9yZXF1ZXN0In0sIHsieC1hbXotZGF0ZSI6ICIyMDE2MTAxMVQyMDM4NDlaIn1dLCAiZXhwaXJhdGlvbiI6ICIyMDE2LTEwLTExVDIxOjM4OjQ5WiJ9', 'x-amz-date': '20161011T203849Z'}, 'url': u'https://s3.amazonaws.com/bucketname'}
  </code></pre>
  
  <p>Code currently on Heroku:</p>
  
  <pre><code>@api.route('/post_track', methods=['POST'])
  @login_required
  def post_track():
      if request.method == 'POST':
          file = request.files['file']
          track = Track.upload_fromJSON(request.form.get('share'), request.form.get('title'))
  
          //Postgres entry
          conn = get_conn()
          with conn.cursor() as cur:
              cur.execute('INSERT INTO tracks(user_id, title, share)'
                      'VALUES (%s, %s, %s) RETURNING id;',
                      (track.user_id, track.title, track.share))
              track_id = cur.fetchone()[0]
              conn.commit()
  
              //Obtain pre-signed request
              signed_request = get_signed_request(track.title, request.form.get('type'), track_id, file)
              return json.dumps({'response':signed_request})
  
  
  def get_signed_request(title, type, track_id, file):
      S3_BUCKET = os.environ.get('S3_BUCKET')
      file_name = title
      file_type = type
      region = 'us-east-1'
      s3 = boto3.client('s3', region_name=region, config=Config(signature_version='s3v4'))
  
      presigned_post = s3.generate_presigned_post(
          Bucket = S3_BUCKET,
          Key = file_name
      )
  
      files = {'file': file}
  
      r_response = requests.post(presigned_post["url"], data=presigned_post["fields"], files=files)
  
      print(r_response)
      print(r_response.text)
  </code></pre>
  
  <p>I'm eventually going to set up the code to return the pre-signed request to my frontend and do a direct upload from there.  Just doing this as a test run.  </p>