Hey John,
I'd suggest to stay away from pyCurl - I think it's a really over-complicated mess (mapping C semantics to Python isn't a really clever approach ;-)
Use the Requests package instead - it's a much better fit...
It's more or less like this:
import requests
from collections import OrderedDict
from json import dumps
session = requests.Session()
session.verify = False
session.headers.update({'Accept': 'application/json', 'Content-Type': 'application/json'})
session.headers.update({'X-HCPAW-FSS-API-VERSION': 'whateverAPIversion'})
auth = OrderedDict([('username', 'myuser),
('password', 'mypassword'),
('grant_type', 'urn:hds:oauth:negotiate-client')])
r = self.session.post('https://aw.domain.com/fss/public/login/oauth',
data=dumps(auth))
if r.status_code == 200:
rr = r.json()
api = sorted(r.headers['X-HCPAW-SUPPORTED-FSS-API-VERSIONS'].split(','), reverse=True)[0]
session.headers.update({'X-HCPAW-FSS-API-VERSION': api,
'Authorization': '{} {}'.format(rr['token_type'], rr['access_token'])})
Now you have the required auth token in the session header and you can continue with other calls using that session without thinking about it at all ;-)
For more details have a look at the awftp code...
(Forget about the SAML auth code in there, it doesn't work with actual AW versions.)
/Thorsten