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