Use the python url parser for encoding arguments
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
e0d1c85259
commit
d07bf33f44
|
@ -2,12 +2,13 @@
|
|||
# Copyright 2015 (c) Anna Schumaker
|
||||
#
|
||||
import json
|
||||
from urllib import parse
|
||||
from urllib import request
|
||||
|
||||
__SLACK_SERVER = "https://slack.com/api"
|
||||
|
||||
def call(method, **kwargs):
|
||||
args = "&&".join("%s=%s" % x for x in kwargs.items())
|
||||
args = parse.urlencode(kwargs)
|
||||
with request.urlopen("%s/%s?%s" % (__SLACK_SERVER, method, args)) as req:
|
||||
return json.loads(req.read().decode())
|
||||
return {"ok" : False}
|
||||
|
|
Loading…
Reference in New Issue