source: TI12-security/trunk/NDGSecurity/python/Tests/pycurl/test_pycurl.py @ 7681

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/Tests/pycurl/test_pycurl.py@7681
Revision 7681, 1.0 KB checked in by pjkersha, 10 years ago (diff)

Incomplete - task 16: NDG Security 2.0.1 - incl. updated Paster templates

  • Fix mutable keyword defaults
  • Property svn:keywords set to Id
Line 
1import pycurl
2import cStringIO
3import os
4#os.environ['CURL_CA_BUNDLE'] = '/home/pjkersha/Documents/BADC/Certificates/Cybertrust/cybertrustCombo.crt'
5#caPath = '/usr/local/ndg/ca/ndg-test-ca.crt'
6caPath = '/workspace/ndg_security_python/Tests/esg_integration/esg_trusted_certificates'
7#url = 'https://ndg3beta.badc.rl.ac.uk/openid'
8#url = 'https://localhost/openid'
9url = 'https://pcmdi3.llnl.gov/esgcet/saml/soap/secure/attributeService.htm'
10print pycurl.version_info()
11for i in dir(pycurl):
12    print i
13   
14c = pycurl.Curl()
15
16# SSL Options
17c.setopt(pycurl.SSL_VERIFYPEER, 0)
18c.setopt(pycurl.SSL_VERIFYHOST, 0)
19c.setopt(pycurl.CAINFO, caPath)
20c.setopt(pycurl.CAPATH, caPath)
21
22data = cStringIO.StringIO()
23headerData = cStringIO.StringIO()
24
25c.setopt(pycurl.WRITEFUNCTION, data.write)
26c.setopt(pycurl.HEADERFUNCTION, headerData.write)
27c.setopt(pycurl.URL, url)
28
29try:
30    c.perform()
31except:
32    pass
33info = c.getinfo(pycurl.SSL_VERIFYRESULT)
34
35code = c.getinfo(pycurl.RESPONSE_CODE)
36print code
37print headerData.getvalue()
38print data.getvalue()
Note: See TracBrowser for help on using the repository browser.