|
|
@ -1,8 +1,16 @@ |
|
|
|
from __future__ import print_function |
|
|
|
from argparse import ArgumentParser |
|
|
|
import json, sys |
|
|
|
from urllib import urlencode |
|
|
|
from urllib2 import urlopen, HTTPError, URLError |
|
|
|
|
|
|
|
try: |
|
|
|
# python2 |
|
|
|
from urllib2 import urlopen, URLError, HTTPError |
|
|
|
from urllib import urlencode |
|
|
|
except ImportError: |
|
|
|
# python3 |
|
|
|
from urllib.parse import urlencode, quote |
|
|
|
from urllib.request import urlopen, URLError, HTTPError |
|
|
|
|
|
|
|
import requests |
|
|
|
|
|
|
|
|
|
|
@ -56,5 +64,5 @@ def main(args): |
|
|
|
results = requests.post(requesturl, params=data) # json.load(urlopen(requesturl)) |
|
|
|
results = json.loads(results.text) |
|
|
|
if results['code'] != 0: |
|
|
|
print (u"setText: ERROR ({0}) on pad {1}: {2}".format(results['code'], args.padid, results['message']).encode("utf-8")) |
|
|
|
print ("setText: ERROR ({0}) on pad {1}: {2}".format(results['code'], args.padid, results['message'])) |
|
|
|
# json.dumps(results, indent=2) |
|
|
|