Skip to content

Commit

Permalink
friendrequest call
Browse files Browse the repository at this point in the history
which doesn't work
  • Loading branch information
bloodywing committed Aug 21, 2015
1 parent a00a8ed commit 73943cb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions kwick/kwick.py
Expand Up @@ -249,3 +249,23 @@ def kwick_friendrequests(self, page=0):
page=page
)
return self.get(url)

def kwick_friendrequest(self, username, action, reason=None):
"""
:parameter action accept|reject|create|withdraw
"""
url = '/{username}/friendrequest/{action}'.format(
username=username,
action=action
)

if action == 'create':
data = dict(reason=reason)
json = self.post(url, data=data)
else:
json = self.get(url)

if 'errorMsg' in json:
raise KwickError(json)
else:
return json

0 comments on commit 73943cb

Please sign in to comment.