title: Convert NodeJS HTTP post script to Python
body: <p>I'm trying to call this Node.JS script (which is a unit test) to Python equivalent. It basically generates an AWS token, and uses that to send a .json file as HTTP post request. How can I re-write it in Python? I already did the token generation part.</p>
  <p>Here is the NodeJS script:</p>
  <pre><code>describe('Send config file', () =&gt; {
    let token = '';
    before(function beforetest(done) {
      this.timeout(10000);
      tokengen(cognitoUser, authenticationDetails).then((result) =&gt; {
        token = result.getAccessToken().getJwtToken();
        done();
      }, (err) =&gt; {
        done(err);
      });
    });
  
    it('should send config json', function test(done) {
      this.timeout(10000);
      chai.request(app)
        .post(`${route}/sendjson`).set('accesstoken', token)
        .send(vcamconfig)
        .end((err, res) =&gt; {
          expect(res).to.have.status(200);
          expect(res.body).to.be.an('object');
          expect(res.body).to.have.property('msg');
          expect(res.body.msg).to.equal('Uploaded to S3');
          console.log(res.body);
          done();
        });
    });
  });
  </code></pre>
  <p>And here is the python script I attempted so far to generate an AWS token. I need to use the token to send a file as a POST request.</p>
  <pre><code>from warrant.aws_srp import AWSSRP
  import boto3
  
  username = &quot;user3&quot;
  password = &quot;user3&quot;
  client_id = &quot;myclientID1234567890&quot;
  user_pool_id = &quot;us-east-1_sdhjsasls&quot;
  region = &quot;us-east-1&quot;
  
  client = boto3.client('cognito-idp', region_name=region)
  
  aws = AWSSRP(username=username, password=password, pool_id=user_pool_id, client_id=client_id, client=client)
  tokens = aws.authenticate_user()
  print(tokens)
  </code></pre>