pythonlinuxskypeskype4py

Skype4Py: Unable to authorize incoming buddy requests


I'm trying to write an app that automatically handles Skype Authorization requests. The final purpose is to allow platform users to attach & confirm their personal Skype handles by messaging a platform-specific Skype user.

Specifically, I'm interested in authorizing and deleting a user from the app user's contact list. I have thoroughly read Linux Skype4Py's Python doc and I haven't found any useful methods. When I try to overwrite the BuddyStatus of an unauthorized user, I get:

for user in skype.UsersWaitingAuthorization:
    print "User: " + user.Handle + " " + str(user.BuddyStatus) # note that _GetBuddyStatus() works here
    if not user.ReceivedAuthRequest.startswith("special-marker"):
        user.BuddyStatus = -1;

Traceback (most recent call last):
  File "gn-discovery-skype.py", line 60, in <module>
    user.BuddyStatus = -1;
  File "/usr/local/lib/python2.7/dist-packages/Skype4Py/user.py", line 80, in _SetBuddyStatus
    self._Property('BUDDYSTATUS', int(Value), Cache=False)
  File "/usr/local/lib/python2.7/dist-packages/Skype4Py/user.py", line 19, in _Property
    return self._Owner._Property('USER', self.Handle, PropName, Set, Cache)
  File "/usr/local/lib/python2.7/dist-packages/Skype4Py/skype.py", line 311, in _Property
    self._DoCommand('SET %s %s' % (jarg, value), jarg)
  File "/usr/local/lib/python2.7/dist-packages/Skype4Py/skype.py", line 281, in _DoCommand
    raise SkypeError(int(errnum), errstr)
Skype4Py.errors.SkypeError: [Errno 518] Invalid status given for BUDDYSTATUS

Would it be the case that Skype (since Skype4Py accepts the status) is actually simply not allowing control over user authorizing, leaving it strictly for an actual Skype user?


Solution

  • If you want to delete someone from contacts list, you have to use 1 not -1.
    Even on someone from skype.Friends BuddyStatus -1 raises error. Try it.
    But if you want to add someone to contacts list, you have to change BuddyStatus to 2.
    It works :)