OpenVPN
http-client.py
Go to the documentation of this file.
1 #!/usr/bin/python
2 import sys
3 import os
4 import httplib
5 
6 f = '/tmp/openvpn_sso_user'
7 with open (f, "r") as myfile:
8  session_key = myfile.read().replace('\n', '')
9 
10 conn = httplib.HTTPConnection("10.8.0.1:8080")
11 conn.request("GET", "/" + session_key)
12 r1 = conn.getresponse()
13 
14 if r1.status == 200:
15  body = r1.read().rstrip()
16  print body
17 elif r1.status == 404:
18  print "Authentication failed"
19 else:
20  print r1.status, r1.reason