Changed dict to query, replaced print with log
This commit is contained in:
@@ -12,11 +12,9 @@ from .models import *
|
|||||||
from .graphql import *
|
from .graphql import *
|
||||||
import time
|
import time
|
||||||
try:
|
try:
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse,parse_qs
|
||||||
from urllib.parse import parse_qs
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse,parse_qs
|
||||||
from urlparse import parse_qs
|
|
||||||
|
|
||||||
|
|
||||||
class Client(object):
|
class Client(object):
|
||||||
@@ -473,26 +471,7 @@ class Client(object):
|
|||||||
"""
|
"""
|
||||||
END DEFAULT THREAD METHODS
|
END DEFAULT THREAD METHODS
|
||||||
"""
|
"""
|
||||||
def removeFriend(self, friend_id=None):
|
|
||||||
"""
|
|
||||||
Removes a specifed friend from your friend list
|
|
||||||
:param friend_id: The id of the friend that you want to remove
|
|
||||||
:returns error when the removing was unsuccessful
|
|
||||||
:returns True when the removing was successful
|
|
||||||
"""
|
|
||||||
payload = {
|
|
||||||
"friend_id": friend_id,
|
|
||||||
"unref": "none",
|
|
||||||
"confirm": "Confirm",
|
|
||||||
}
|
|
||||||
r = self._post(self.req_url.REMOVE_FRIEND,payload)
|
|
||||||
dict = parse_qs(urlparse(r.url).query)
|
|
||||||
if "err" not in dict:
|
|
||||||
print ("Remove was successful!")
|
|
||||||
return True
|
|
||||||
else:
|
|
||||||
print ("Error while removing friend")
|
|
||||||
return False
|
|
||||||
"""
|
"""
|
||||||
FETCH METHODS
|
FETCH METHODS
|
||||||
"""
|
"""
|
||||||
@@ -1337,8 +1316,27 @@ class Client(object):
|
|||||||
|
|
||||||
r = self._post(self.req_url.CONNECT, data)
|
r = self._post(self.req_url.CONNECT, data)
|
||||||
return r.ok
|
return r.ok
|
||||||
|
|
||||||
|
def removeFriend(self, friend_id=None):
|
||||||
|
"""
|
||||||
|
Removes a specifed friend from your friend list
|
||||||
|
:param friend_id: The id of the friend that you want to remove
|
||||||
|
:return: Returns error if the removing was unsuccessful, returns True when successful.
|
||||||
|
"""
|
||||||
|
payload = {
|
||||||
|
"friend_id": friend_id,
|
||||||
|
"unref": "none",
|
||||||
|
"confirm": "Confirm",
|
||||||
|
}
|
||||||
|
r = self._post(self.req_url.REMOVE_FRIEND,payload)
|
||||||
|
query = parse_qs(urlparse(r.url).query)
|
||||||
|
if "err" not in query:
|
||||||
|
log.debug ("Remove was successful!")
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
log.debug ("Error while removing friend")
|
||||||
|
return False
|
||||||
|
|
||||||
"""
|
"""
|
||||||
LISTEN METHODS
|
LISTEN METHODS
|
||||||
"""
|
"""
|
||||||
|
Reference in New Issue
Block a user