Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending a message in Skype using skpy in python

Tags:

python

skype

Scenario: I am trying to work out a way to send a quick test message in skype with a python code. From the documentations (https://pypi.python.org/pypi/SkPy/0.1) I got a snippet that should allow me to do that.

Problem: I refilled the information as expected, but I am getting an error when trying to create the connection to skype in:

sk = Skype(username, password)

I get:

SkypeAuthException: ("Couldn't retrieve t field from login response", )

I have no idea what this error means.

Question: Any idea on how to solve this?

Code: This is basically what I am using, plus my username and password:

from skpy import Skype
sk = Skype(username, password) # connect to Skype

sk.user # you
sk.contacts # your contacts
sk.chats # your conversations

ch = sk.contacts["joe.4"].chat # 1-to-1 conversation

ch.sendMsg(content) # plain-text message

Question 2: Is there any way to do this, in which the password and username should not be in the code? For example, would it be possible to use the skype instance that is already open in that computer?

like image 644
DGMS89 Avatar asked Nov 07 '22 11:11

DGMS89


1 Answers

It might look like you have been blocked from your server's IP if you logged in elsewhere recently. This works for me.

from skpy import Skype
loggedInUser = Skype("userName", "password")
print(loggedInUser.users)               // loggedIn user info
print(loggedInUser.contacts)            // loggedIn user contacts

PS: skpy version: 0.8.1

like image 90
Devanshu Jain Avatar answered Nov 14 '22 22:11

Devanshu Jain