x-auth token in requests module

Question:

Here is my sample curl requests.

 curl -g -i -X 'GET' 'https://us-ny-3.cloud.rac.com:8777/v2/meters' -H 'User-Agent: ceilometerclient.openstack.common.apiclient' -H 'X-Auth-Token: {SHA1}e8198c33b3d1b0748fa3db5cd6821d33951d67c8'

I want to replicate the same requests using Python request module.

request.get(‘https://us-ny-3.cloud.rac.com:8777/v2/meters‘) is what im using but im not sure on how to pass the x-auth-token.

Asked By: user1050619

||

Answers:

As @bereal suggest a simple search in the DOC and you will figure it out.

import requests
headers = {'User-Agent': 'ceilometerclient.openstack.common.apiclient',
           'X-Auth-Token': '{SHA1}e8198c33b3d1b0748fa3db5cd6821d33951d67c8'
           }
r = requests.get("https://us-ny-3.cloud.rac.com:8777/v2/meters",headers=headers)
Answered By: Chaker
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.