Python Skype
Python Skype
http://query7.com/interacting-with-skype-from-pyth...
Query7
Home Request A Tutorial About Contact
Installation
Skype4Py is a normal Python module and is listed in the Python package index (Pypi). To install it with setuptools enter the following in a command prompt.
easy_install Skype4Py
Getting Started
Skype4Py interacts with the Skype client running on your desktop, it doesnt talk directly to the Skype servers. For any of the scripts we cover in this tutorial to work the Skype application must be running and you need to be logged in. You can either start Skype yourself or use the following snippet to start it using Skype4Py.
s = Skype4Py.Skype() if not s.Client.IsRunning: s.Client.Start()
Before we can interact with the Skype client from Skype2Py, we need to connect Skype4Py to the instance of Skype running on your desktop. This is done using the Attach method.
1 de 5 28-02-2012 14:07
http://query7.com/interacting-with-skype-from-pyth...
After executing this you need to check the Skype client on your desktop. A notication similar to the one below will appear. This ensures that no virus or 3rd party program can use your Skype account without your knowledge. Click Allow access.
User Information
Skype4Py provides a User class which represents a users Skype account. We can access information such as the users full name, their Skype status and when they were last logged into Skype. To get the person who is currently logged into the Skype clients information we need to use the CurrentUser class.
import Skype4Py s = Skype4Py.Skype() s.Attach() print 'Full Name: %s' % s.CurrentUser.FullName print 'Skype Status: %s' % s.CurrentUser.OnlineStatus print 'Country: %s' % s.CurrentUser.Country
To access information about the current Skype users friends, we need to use the Friends class. The snippet below iterates over all of the current Skype users friends and prints some information about them.
import Skype4Py s = Skype4Py.Skype() s.Attach() for f in s.Friends: print 'Full Name: %s' % f.FullName print 'Skype Status: %s' % f.OnlineStatus print 'Country: %s' % f.Country
2 de 5
28-02-2012 14:07
http://query7.com/interacting-with-skype-from-pyth...
double checking it rst. Make sure you include your countrys international prex at the beginning of the number variable. After using this code my phone received the SMS 20 seconds later (NZ carrier).
import Skype4Py s = Skype4Py.Skype() s.Attach() message = 'Hello SMS from Query7' number = '+641234567890' m = s.CreateSms(Skype4Py.smsMessageTypeOutgoing, number) m.Body = message m.Send()
Leave a Reply
You must be logged in to post a comment.
Search Keywords
Search
Categories
ActionScript (2)
3 de 5
28-02-2012 14:07
http://query7.com/interacting-with-skype-from-pyth...
ajax (3) Android (4) Best Practices (7) book review (1) code (4) Code Igniter (3) Design (7) django (4) dropbox (2) fedora (3) Flash (2) Flex (6) Git (2) JavaScript (9) jQuery (21) kohana (4) linux (9) Mail (1) mongodb (1) nodejs (1) php (32) php-gtk (2) Programming (16) Python (9) Ruby on Rails (2) security (2) This Week in Web (25) Titanium Mobile (4) Tutorials (23) twig (2) videotutorial (4) Web 2.0 (5) Web Development (72) wordpress (1) Zend (3)
Recent Posts
This Week in Web PHP Needs X, Python IDEs, Firefox5, jQuery Mobile, Python Games This Week in Web SMF2, ZF2, Python Lamdas, Future of JS, Titanium 1.7 This Week in Web -Django Hosting, Podcasts, Git Tutorials, Python Apps
4 de 5 28-02-2012 14:07
http://query7.com/interacting-with-skype-from-pyth...
with Titanium This Week in Web jQuery API, Python Video Archive, Symfony2 Beta, Heatmap.js This Week In Web Python, NodeJS CMS, Google APIs, XDebug
Recent Comments
Tijmen on Titanium Mobile Android Development: First Application logan on Titanium Mobile Android Development: First Application Tijmen on Titanium Mobile Android Development: First Application Tyrael on Why You Should Be Using a PHP Framework nicoSWD on Why You Should Be Using a PHP Framework
Blogroll
Sourcebits Blog Spoonjuice Blog Android Development iPhone Development Web Development 2011 Query7 - Powered by Wordpress. Web Development by
5 de 5
28-02-2012 14:07