diff options
Diffstat (limited to 'client/gentoostats-send')
-rwxr-xr-x | client/gentoostats-send | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/client/gentoostats-send b/client/gentoostats-send index 2ae2857..eac742c 100755 --- a/client/gentoostats-send +++ b/client/gentoostats-send @@ -1,10 +1,21 @@ #!/usr/bin/env python +from __future__ import print_function + import sys import json import argparse -import ConfigParser -import httplib + +try: + import configparser as ConfigParser +except ImportError: + import ConfigParser + +try: + import http.client as httplib +except ImportError: + import httplib + from gentoostats.payload import Payload def getAuthInfo(auth): @@ -67,8 +78,8 @@ def main(): conn = httplib.HTTPSConnection(args['server'] + ':' + str(args['port'])) conn.request('POST', url=post_url, headers=post_headers, body=post_body) response = conn.getresponse() - print response.status, response.reason - print 'Server response: ' + response.read() + print(response.status, response.reason) + print('Server response: ' + response.read().decode("utf-8")) except httplib.HTTPException: sys.stderr.write('Something went wrong') sys.exit(1) |