summaryrefslogtreecommitdiff
path: root/ricky/im.py
diff options
context:
space:
mode:
Diffstat (limited to 'ricky/im.py')
-rw-r--r--ricky/im.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/ricky/im.py b/ricky/im.py
index 715d825..159aa89 100644
--- a/ricky/im.py
+++ b/ricky/im.py
@@ -1,19 +1,23 @@
import urllib
import urllib2
import sys
-import random
import simplejson as json
-import urllib2
+
class Im:
def __init__(self):
self._required_keys = []
self.url = ""
+
def post_request(self, url, params):
params = urllib.urlencode(params)
headers = {
"Content-type": "application/x-www-form-urlencoded",
- "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.94 Safari/537.36",
+ "User-Agent":(
+ "Mozilla/5.0 (X11; Linux x86_64) "
+ "AppleWebKit/537.36 (KHTML, like Gecko) "
+ "Chrome/40.0.2214.94 Safari/537.36"
+ ),
"Accept": "text/plain"
}
try:
@@ -23,7 +27,8 @@ class Im:
except Exception as e:
sys.stderr.write(str(e))
raise
+
def call(self, params):
if not(params.is_ready()):
- raise Exception("Im Params Not Ready")
+ raise Exception("Im Params Not Ready")
return json.loads(self.post_request(self.url, params.as_dict()))