SlideShare une entreprise Scribd logo
1  sur  55
Twittering with Python
Python libraries for the Twitter API:
Overview and applications
EuroPython 2009 (June 30th 2009, Birmingham)
Andreas Schreiber <Andreas.Schreiber@dlr.de>
German Aerospace Center (DLR), Cologne, Germany
http://www.dlr.de/sc

                                                                                                           Folie 1
                                            EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Final Version of this Slides is
 available on SlideShare




http://tr.im/ep09twt


                                                                                                  Folie 2
                                   EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Follow this presentation…




twitter.com/python_demo



                                                                                            Folie 3
                             EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
What is Twitter?


Micro-Blogging Service
   Users can send text messages
   Users can receive text messages of others
   Text messages can have up to 140 characters
   The text messages are called „Updates“ or „Tweets“

Socal Network
   One can subscribe to other users („Following“)
   Subscriber of own updates are „Follower“
   On the Twitter web site one can enter updates and …
   see updates of all Friends
   Users can control visibility
                                                                 http://en.wikipedia.org/wiki/Twitter

                                                                                                               Folie 4
                                                EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Folie 5
EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Who twitters?


Persons (private persons, „Celebrities“, politicians, …)
   Guido van Rossum, Ian Foster, Rainer Calmund, Herrmann Otto Solms
Research centers & universities
   DLR, ESA, NASA, Fraunhofer, DHBW Mannheim, FH Köln, Cardiff Uni.
Companies (publishers, IT companies, Dienstleister, …)
   O‘Reilly, Heise, Sun Microsystems, Google, XING, Starbucks, Bahn
Software projects & products
   Digsby, Dropbox, Plone, Jython, SharePoint, SlideShare, Camtasia
Media (Newspapers, TV stations, TV shows, …)
   Bild, Welt, Focus, ZEIT, BBC, CNN, Pro7, TV Total
Conferences and organizations
   EuroPython, PyCon, Supercomputing, EclipseCon, Greenpeace

                                                                                                             Folie 6
                                              EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Folie 7
EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Guido van Rossum




                                                                                  Folie 8
                   EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
DLR_de




                                                                        Folie 9
         EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
O‘Reilly




                                                                        Folie 10
           EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Plone




                                                                     Folie 11
        EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Focus Online




                                                                            Folie 12
               EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
EuroPython




                                                                          Folie 13
             EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Web Sites and Technologies


http://twitter.com
    Web application developed with Ruby on Rails
    Message Queue Server Kestrel (fka. Starling)
    developed in Scala
          Available under Apache 2.0 License
          http://github.com/robey/kestrel/tree/master


http://search.twitter.com
    Originally develop by Summize
    Real time search over Twitter-XMPP-Stream
    Requests with Atom and JSON:
    http://search.twitter.com/search.atom?q=<query>
    http://search.twitter.com/search.json?q=<query>

                                                                                                     Folie 14
                                        EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twitter Basics (1)


Tweet
  A Post (message, update) at Twitter
  Max. 140 Characters (incl. white space), only text

Timeline
   History of the latest updates
   „Public Timeline“:
   Updates of all users („Everyone“)




                                                                                                               Folie 15
                                                  EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twitter Basics (2)


Follow
    Selection of „Friends“ for your own
    timeline („Stream“)
    „Followers“ are following you own
    updates

Personal Page
   You own Timeline
   Status informationen




                                                                                                       Folie 16
                                          EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twitter Basics (3)


Replies
    Response to an other user
    To reply, add „@username“
    to the message
    Replies can be from your „Friends“
    or any other user
Direct Messages
    Private messages
    Can be sent to your “Follower” only,
    not to “Friends”
Retweets
    „Forward“ of interesting updates to own friends
    Usually, Retweets starts with a „RT“

                                                                                                                   Folie 17
                                                      EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Hashtags


Hashtags in Twitter messages
   Begins with a hash „#“
   Often used for events, cities, countries, …
Examples
         #birmingham                              #europython




                                                                                                              Folie 18
                                                 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twitter Applications


Web applications

Native Clients
   Windows, Mac OS X, Linux
   iPod/iPhone
   Smartphones

Integration in existing applications
    Instant Messenger
    Social Networking Services

See list at
   http://twitter.pbwiki.com/Apps


                                                                                                    Folie 19
                                       EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twitter API




                                                                           Folie 20
              EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twitter API


REST-based API
  HTTP-Requests
  Data formats: XML, JSON, RSS, Atom
  Authentication with OAuth or HTTP Basic Authentication
  Error messages are provided (e.g., in XML):
              <?xml version="1.0" encoding="UTF-8"?>
              <hash>
                <request>/direct_messages/destroy/456.xml</request>
                <error>No direct message with that ID found.</error>
              </hash>


   Limitation: Max. 100 Requests in 60 minutes per client
         Based on: IP (unauthorized) or User ID (authorized)

Documentation: http://apiwiki.twitter.com


                                                                                                                          Folie 21
                                                             EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
API Methods (1)


Status Methods              User Methods
   public_timeline             friends
   friends_timeline            followers
   user_timeline               featured
   show                        show
   update                   Direct Message Methods
   replies                     direct_messages
   destroy                     sent
Account Methods                new
   verify_credentials          destroy
   end_session              Friendship Methods:
   archive                     create
   update_location             destroy
   update_delivery_device      exists

                                                                                                        Folie 22
                                           EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
API Methods (2)


Favorite Methods       Notification Methods
   favorites              follow
   create                 leave
   destroy
                       Block Methods
Help Methods              create
   test                   destroy
   downtime_schedule




                                                                                                 Folie 23
                                    EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Authentication
Two Techniques to Authenticate with the REST API

Basic Auth
   Sends user credentials in the header of the HTTP request
   Easy to use, but insecure and difficult to track

OAuth
  Token-passing mechanism
  Allows users to control which application
  have access to their data without
  giving away their passwords
  Specification: http://oauth.net/
  Registration of clients:
  http://twitter.com/oauth_clients

                                                                 http://oauth.net/core/1.0/

                                                                                                              Folie 24
                                                 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twitter API: Getting Started (1)
Public Timeline

Getting the Public Timeline (last 20 entries)
   As RSS
curl http://twitter.com/statuses/public_timeline.rss


   As JSON
curl http://twitter.com/statuses/public_timeline.json


   As XML
curl http://twitter.com/statuses/public_timeline.xml




                                                                                                             Folie 25
                                                EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twitter API: Getting Started (2)
Timeline of your own „Friends“

curl -u python_demo:***
       http://twitter.com/statuses/friends_timeline.xml




                                                                                                  Folie 26
                                     EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twitter API: Getting Started (3)
Posting of „Updates“
curl -u python_demo:****
       -d status="This message was sent using cURL"
       http://twitter.com/statuses/update.json




                                                                                                  Folie 27
                                     EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Libraries


List of libraries: http://apiwiki.twitter.com/Libraries
    ActionScript / Flash
    C++
    C#/.NET
    Java
    Objective-C/Cocoa
    Perl
    PHP
    PL/SQL
    Python
    Ruby
    Scala

                                                                                                                Folie 28
                                                   EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twitter Libraries in Python


Python Libraries
   python-twitter by DeWitt Clinton.
   This library provides a pure Python interface for
   the Twitter API.
   python-twyt by Andrew Price.
   BSD licensed Twitter API interface library and
   command line client.
   twitty-twister by Dustin Sallings.
   A Twisted interface to Twitter.
   Python Twitter Tools (PPT) by Mike Verdone
   a Twitter API, command-line tool, and IRC bot

                                                                                                                 Folie 29
                                                    EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
python-twitter
Pure Python Interface for the Twitter API

Project information
   Project site: http://code.google.com/p/python-twitter/
   Author: DeWitt Clinton (Google; http://unto.net)
   Apache License 2.0

Provided functionality
   Supported Methods: Status, User, Direct message
   Authentication: Basic Auth
   Provides a Python wrapper around the Twitter API and data model

Requirements
   simplejson (http://cheeseshop.python.org/pypi/simplejson)

                                                                                                                 Folie 30
                                                    EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twyt
A Twitter API interface for Python

Project information
   Project site: http://andrewprice.me.uk/projects/twyt/
   Author: Andrew Price
   BSD License

Provided functionality
   Supported Methods: Status, User, Direct Message, Friendship, Social
   Graph, Block
   Authentication: Basic Auth, OAuth




                                                                                                                 Folie 31
                                                    EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
twitty-twister
A Twisted interface to Twitter

Project information
   Project site:
   http://github.com/dustin/twitty-twister/tree/master
   Author: Dustin Sallings
   License: ?

Provided functionality
   Supported methods: Status, User, Direct message, Friendship
   Authentication: Basic Auth, OAuth




                                                                                                                 Folie 32
                                                    EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Python Twitter Tools (PTT)
Twitter API, command-line tool, and IRC bot

Project information
   Projekt site: http://mike.verdone.ca/twitter/
   Author: Mike Verdone
   MIT License

Provided functionality
   Supported methods: status, user, direct message
   Authentication: Basic Auth
   IRC bot that can announce Twitter updates to an IRC channel

Requirements
   irclib (http://python-irclib.sourceforge.net)

                                                                                                                Folie 33
                                                   EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Comparison
Python Twitter Libraries

   Library          Supported API          Supported      Requirements
                    Methods                Authentication

   Python-twitter Status, User, Direct     Basic Auth                simplejson
                  message

   Twyt             Status, User, Direct   Basic Auth,
                    Message,               OAuth
                    Friendship, Social
                    Graph, Block
   Twitty-twister   Status, User, Direct   Basic Auth,               Twisted
                    message,               OAuth
                    Friendship
   Python           Status, User, Direct   Basic Auth                (irclib)
   Twitter Tools    message



                                                                                                                      Folie 34
                                                         EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Examples and Demos




                                                                                  Folie 35
                     EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Example
Get all Updates of a User

         import twitter

         api = twitter.Api()

         statuses = api.GetUserTimeline('DLR_de')
         print [s.text for s in statuses[:5]]

  [u"Video: @NASA's SOFIA mission update http://tinyurl.com/cmmna3
  #SOFIA (Stratospheric Observatory For Infrared Astronomy)", u'Video
  zur GOCE-Mission (Messung der Schwerkraft) http://tinyurl.com/c5zhdb
  #euronews', u'(EN) Now following @ESAGermany and @ESAGOCE',
  u'@AndreasSchepers Gute Frage. Immerhin hat die NASA-Mission
  keinen Vornamen. #Johannes #ATV #NASA', u'RT @AndreasSchepers
  Thomas Reiter: Wir wissen mehr xfcber den Mars als den Mond.
  http://is.gd/k7qZ #Mp3 #DeutschlandRadioKultur #DLR-Vorstand']


                                                                                                           Folie 36
                                              EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Example
Posting an Update

import twitter

api = twitter.Api(username='python_demo',
                  password='***')

api.PostUpdate('Moin!')




                                                                                                         Folie 37
                                            EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Example
Adding a Friend („Follow“)

import twitter
api = twitter.Api(username='python_demo', password='***')

user = api.CreateFriendship('pycologne')
print user
  {"description": "Python User Group Cologne", "id": 23515458, "location":
  "Cologne, Germany", "name": "PyCologne", "profile_image_url":
  "http://s3.amazonaws.com/twitter_production/profile_images/91413444/p
  ycologne_logo_small_quadratisch_normal.jpg", "screen_name":
  "pycologne", "url": "http://www.pycologne.de"}




                                                                                                             Folie 38
                                                EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Example
„tail –f“ to Twitter
# based on http://code.activestate.com/recipes/157035/
import time, os

import twitter
api = twitter.Api(username='python_demo', password=‘***')

file = open('test.log','r')

# ... <Find the size of the file and move to the end>

while 1:
    where = file.tell()
    line = file.readline()
    if not line:
         time.sleep(1)
         file.seek(where)
    else:
         api.PostUpdate(line)

                                                                                                      Folie 39
                                         EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Example
„tail –f“ to Twitter




                                                                                    Folie 40
                       EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Demo
Twitter in Software Engineering

  Notifications from SVNChecker (http://svnchecker.tigris.org/)




                                                                                                               Folie 41
                                                  EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Demo
Twitter on Smart Phones

  Posting incoming SMS to Twitter account




                                                                                                         Folie 42
                                            EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Demo
Twitter Notification from MoinMoin Wiki

  Twitter handler for the MoinMoin Event System




                              python-twitter




                                                                                                               Folie 43
                                                  EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
Twittering with Python
Twittering with Python
Twittering with Python
Twittering with Python
Twittering with Python
Twittering with Python
Twittering with Python
Twittering with Python
Twittering with Python
Twittering with Python
Twittering with Python
Twittering with Python

Contenu connexe

Similaire à Twittering with Python

Microblogging
MicrobloggingMicroblogging
Microbloggingrdotd
 
Hyperkitty: Updating Mailman's UI
Hyperkitty: Updating Mailman's UIHyperkitty: Updating Mailman's UI
Hyperkitty: Updating Mailman's UIMáirín Duffy
 
Oggcamp and Hackcamp
Oggcamp and HackcampOggcamp and Hackcamp
Oggcamp and Hackcampmattcopp
 
Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015Bruno R. Zanuzzo
 
We19 Learn Python! Why and How
We19 Learn Python! Why and HowWe19 Learn Python! Why and How
We19 Learn Python! Why and HowLinda Ruetz
 
Learn PYTHON at ASIT
Learn PYTHON at ASITLearn PYTHON at ASIT
Learn PYTHON at ASITASIT
 
Python 101 For The Net Developer
Python 101 For The Net DeveloperPython 101 For The Net Developer
Python 101 For The Net DeveloperSarah Dutkiewicz
 
Publish Live Stream On Social Media Platforms.pptx
Publish Live Stream On Social Media Platforms.pptxPublish Live Stream On Social Media Platforms.pptx
Publish Live Stream On Social Media Platforms.pptxnoreplyerp
 
Open Source .NET
Open Source .NETOpen Source .NET
Open Source .NETOnyxfish
 
Micropython for the iot
Micropython for the iotMicropython for the iot
Micropython for the iotJacques Supcik
 
Python final presentation kirti ppt1
Python final presentation kirti ppt1Python final presentation kirti ppt1
Python final presentation kirti ppt1Kirti Verma
 
Python Programmimg language in Gurugram
Python  Programmimg language in GurugramPython  Programmimg language in Gurugram
Python Programmimg language in Gurugramdigitallynikitasharm
 

Similaire à Twittering with Python (20)

Microblogging
MicrobloggingMicroblogging
Microblogging
 
Hyperkitty: Updating Mailman's UI
Hyperkitty: Updating Mailman's UIHyperkitty: Updating Mailman's UI
Hyperkitty: Updating Mailman's UI
 
Python tutorial
Python tutorialPython tutorial
Python tutorial
 
Oggcamp and Hackcamp
Oggcamp and HackcampOggcamp and Hackcamp
Oggcamp and Hackcamp
 
Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015
 
python 1
python 1python 1
python 1
 
Python programming language
Python programming languagePython programming language
Python programming language
 
Better Code With Python
Better Code With PythonBetter Code With Python
Better Code With Python
 
We19 Learn Python! Why and How
We19 Learn Python! Why and HowWe19 Learn Python! Why and How
We19 Learn Python! Why and How
 
Learn PYTHON at ASIT
Learn PYTHON at ASITLearn PYTHON at ASIT
Learn PYTHON at ASIT
 
Python 101 For The Net Developer
Python 101 For The Net DeveloperPython 101 For The Net Developer
Python 101 For The Net Developer
 
Publish Live Stream On Social Media Platforms.pptx
Publish Live Stream On Social Media Platforms.pptxPublish Live Stream On Social Media Platforms.pptx
Publish Live Stream On Social Media Platforms.pptx
 
Open Source .NET
Open Source .NETOpen Source .NET
Open Source .NET
 
Micropython for the iot
Micropython for the iotMicropython for the iot
Micropython for the iot
 
Welcome_to_Python.pptx
Welcome_to_Python.pptxWelcome_to_Python.pptx
Welcome_to_Python.pptx
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 
python-ppt.ppt
python-ppt.pptpython-ppt.ppt
python-ppt.ppt
 
Python final presentation kirti ppt1
Python final presentation kirti ppt1Python final presentation kirti ppt1
Python final presentation kirti ppt1
 
Python Programmimg language in Gurugram
Python  Programmimg language in GurugramPython  Programmimg language in Gurugram
Python Programmimg language in Gurugram
 
Sipana Opensourcejam
Sipana OpensourcejamSipana Opensourcejam
Sipana Opensourcejam
 

Plus de Andreas Schreiber

Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...Andreas Schreiber
 
Visualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented RealityVisualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented RealityAndreas Schreiber
 
Provenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructureProvenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructureAndreas Schreiber
 
Raising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace CenterRaising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace CenterAndreas Schreiber
 
Open Source Licensing for Rocket Scientists
Open Source Licensing for Rocket ScientistsOpen Source Licensing for Rocket Scientists
Open Source Licensing for Rocket ScientistsAndreas Schreiber
 
Interactive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality HeadsetsInteractive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality HeadsetsAndreas Schreiber
 
Provenance for Reproducible Data Science
Provenance for Reproducible Data ScienceProvenance for Reproducible Data Science
Provenance for Reproducible Data ScienceAndreas Schreiber
 
Visualizing Provenance using Comics
Visualizing Provenance using ComicsVisualizing Provenance using Comics
Visualizing Provenance using ComicsAndreas Schreiber
 
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-VerletzungenNachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-VerletzungenAndreas Schreiber
 
Reproducible Science with Python
Reproducible Science with PythonReproducible Science with Python
Reproducible Science with PythonAndreas Schreiber
 
A Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self DataA Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self DataAndreas Schreiber
 
Tracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The RestTracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The RestAndreas Schreiber
 
High Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris DataHigh Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris DataAndreas Schreiber
 
Bericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & ExpositionBericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & ExpositionAndreas Schreiber
 
Telemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermannTelemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermannAndreas Schreiber
 
Quantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-SensorenQuantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-SensorenAndreas Schreiber
 

Plus de Andreas Schreiber (20)

Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
Provenance-based Security Audits and its Application to COVID-19 Contact Trac...
 
Visualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented RealityVisualization of Software Architectures in Virtual Reality and Augmented Reality
Visualization of Software Architectures in Virtual Reality and Augmented Reality
 
Provenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructureProvenance as a building block for an open science infrastructure
Provenance as a building block for an open science infrastructure
 
Raising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace CenterRaising Awareness about Open Source Licensing at the German Aerospace Center
Raising Awareness about Open Source Licensing at the German Aerospace Center
 
Open Source Licensing for Rocket Scientists
Open Source Licensing for Rocket ScientistsOpen Source Licensing for Rocket Scientists
Open Source Licensing for Rocket Scientists
 
Interactive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality HeadsetsInteractive Visualization of Software Components with Virtual Reality Headsets
Interactive Visualization of Software Components with Virtual Reality Headsets
 
Provenance for Reproducible Data Science
Provenance for Reproducible Data ScienceProvenance for Reproducible Data Science
Provenance for Reproducible Data Science
 
Visualizing Provenance using Comics
Visualizing Provenance using ComicsVisualizing Provenance using Comics
Visualizing Provenance using Comics
 
Quantified Self Comics
Quantified Self ComicsQuantified Self Comics
Quantified Self Comics
 
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-VerletzungenNachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
Nachvollziehbarkeit mit Hinblick auf Privacy-Verletzungen
 
Reproducible Science with Python
Reproducible Science with PythonReproducible Science with Python
Reproducible Science with Python
 
Python at Warp Speed
Python at Warp SpeedPython at Warp Speed
Python at Warp Speed
 
A Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self DataA Provenance Model for Quantified Self Data
A Provenance Model for Quantified Self Data
 
Open Source im DLR
Open Source im DLROpen Source im DLR
Open Source im DLR
 
Tracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The RestTracking after Stroke: Doctors, Dogs and All The Rest
Tracking after Stroke: Doctors, Dogs and All The Rest
 
High Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris DataHigh Throughput Processing of Space Debris Data
High Throughput Processing of Space Debris Data
 
Bericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & ExpositionBericht von der QS15 Conference & Exposition
Bericht von der QS15 Conference & Exposition
 
Telemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermannTelemedizin: Gesundheit, messbar für jedermann
Telemedizin: Gesundheit, messbar für jedermann
 
Big Python
Big PythonBig Python
Big Python
 
Quantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-SensorenQuantified Self mit Wearable Devices und Smartphone-Sensoren
Quantified Self mit Wearable Devices und Smartphone-Sensoren
 

Dernier

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Dernier (20)

Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Twittering with Python

  • 1. Twittering with Python Python libraries for the Twitter API: Overview and applications EuroPython 2009 (June 30th 2009, Birmingham) Andreas Schreiber <Andreas.Schreiber@dlr.de> German Aerospace Center (DLR), Cologne, Germany http://www.dlr.de/sc Folie 1 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 2. Final Version of this Slides is available on SlideShare http://tr.im/ep09twt Folie 2 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 3. Follow this presentation… twitter.com/python_demo Folie 3 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 4. What is Twitter? Micro-Blogging Service Users can send text messages Users can receive text messages of others Text messages can have up to 140 characters The text messages are called „Updates“ or „Tweets“ Socal Network One can subscribe to other users („Following“) Subscriber of own updates are „Follower“ On the Twitter web site one can enter updates and … see updates of all Friends Users can control visibility http://en.wikipedia.org/wiki/Twitter Folie 4 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 5. Folie 5 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 6. Who twitters? Persons (private persons, „Celebrities“, politicians, …) Guido van Rossum, Ian Foster, Rainer Calmund, Herrmann Otto Solms Research centers & universities DLR, ESA, NASA, Fraunhofer, DHBW Mannheim, FH Köln, Cardiff Uni. Companies (publishers, IT companies, Dienstleister, …) O‘Reilly, Heise, Sun Microsystems, Google, XING, Starbucks, Bahn Software projects & products Digsby, Dropbox, Plone, Jython, SharePoint, SlideShare, Camtasia Media (Newspapers, TV stations, TV shows, …) Bild, Welt, Focus, ZEIT, BBC, CNN, Pro7, TV Total Conferences and organizations EuroPython, PyCon, Supercomputing, EclipseCon, Greenpeace Folie 6 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 7. Folie 7 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 8. Guido van Rossum Folie 8 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 9. DLR_de Folie 9 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 10. O‘Reilly Folie 10 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 11. Plone Folie 11 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 12. Focus Online Folie 12 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 13. EuroPython Folie 13 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 14. Web Sites and Technologies http://twitter.com Web application developed with Ruby on Rails Message Queue Server Kestrel (fka. Starling) developed in Scala Available under Apache 2.0 License http://github.com/robey/kestrel/tree/master http://search.twitter.com Originally develop by Summize Real time search over Twitter-XMPP-Stream Requests with Atom and JSON: http://search.twitter.com/search.atom?q=<query> http://search.twitter.com/search.json?q=<query> Folie 14 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 15. Twitter Basics (1) Tweet A Post (message, update) at Twitter Max. 140 Characters (incl. white space), only text Timeline History of the latest updates „Public Timeline“: Updates of all users („Everyone“) Folie 15 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 16. Twitter Basics (2) Follow Selection of „Friends“ for your own timeline („Stream“) „Followers“ are following you own updates Personal Page You own Timeline Status informationen Folie 16 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 17. Twitter Basics (3) Replies Response to an other user To reply, add „@username“ to the message Replies can be from your „Friends“ or any other user Direct Messages Private messages Can be sent to your “Follower” only, not to “Friends” Retweets „Forward“ of interesting updates to own friends Usually, Retweets starts with a „RT“ Folie 17 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 18. Hashtags Hashtags in Twitter messages Begins with a hash „#“ Often used for events, cities, countries, … Examples #birmingham #europython Folie 18 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 19. Twitter Applications Web applications Native Clients Windows, Mac OS X, Linux iPod/iPhone Smartphones Integration in existing applications Instant Messenger Social Networking Services See list at http://twitter.pbwiki.com/Apps Folie 19 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 20. Twitter API Folie 20 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 21. Twitter API REST-based API HTTP-Requests Data formats: XML, JSON, RSS, Atom Authentication with OAuth or HTTP Basic Authentication Error messages are provided (e.g., in XML): <?xml version="1.0" encoding="UTF-8"?> <hash> <request>/direct_messages/destroy/456.xml</request> <error>No direct message with that ID found.</error> </hash> Limitation: Max. 100 Requests in 60 minutes per client Based on: IP (unauthorized) or User ID (authorized) Documentation: http://apiwiki.twitter.com Folie 21 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 22. API Methods (1) Status Methods User Methods public_timeline friends friends_timeline followers user_timeline featured show show update Direct Message Methods replies direct_messages destroy sent Account Methods new verify_credentials destroy end_session Friendship Methods: archive create update_location destroy update_delivery_device exists Folie 22 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 23. API Methods (2) Favorite Methods Notification Methods favorites follow create leave destroy Block Methods Help Methods create test destroy downtime_schedule Folie 23 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 24. Authentication Two Techniques to Authenticate with the REST API Basic Auth Sends user credentials in the header of the HTTP request Easy to use, but insecure and difficult to track OAuth Token-passing mechanism Allows users to control which application have access to their data without giving away their passwords Specification: http://oauth.net/ Registration of clients: http://twitter.com/oauth_clients http://oauth.net/core/1.0/ Folie 24 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 25. Twitter API: Getting Started (1) Public Timeline Getting the Public Timeline (last 20 entries) As RSS curl http://twitter.com/statuses/public_timeline.rss As JSON curl http://twitter.com/statuses/public_timeline.json As XML curl http://twitter.com/statuses/public_timeline.xml Folie 25 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 26. Twitter API: Getting Started (2) Timeline of your own „Friends“ curl -u python_demo:*** http://twitter.com/statuses/friends_timeline.xml Folie 26 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 27. Twitter API: Getting Started (3) Posting of „Updates“ curl -u python_demo:**** -d status="This message was sent using cURL" http://twitter.com/statuses/update.json Folie 27 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 28. Libraries List of libraries: http://apiwiki.twitter.com/Libraries ActionScript / Flash C++ C#/.NET Java Objective-C/Cocoa Perl PHP PL/SQL Python Ruby Scala Folie 28 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 29. Twitter Libraries in Python Python Libraries python-twitter by DeWitt Clinton. This library provides a pure Python interface for the Twitter API. python-twyt by Andrew Price. BSD licensed Twitter API interface library and command line client. twitty-twister by Dustin Sallings. A Twisted interface to Twitter. Python Twitter Tools (PPT) by Mike Verdone a Twitter API, command-line tool, and IRC bot Folie 29 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 30. python-twitter Pure Python Interface for the Twitter API Project information Project site: http://code.google.com/p/python-twitter/ Author: DeWitt Clinton (Google; http://unto.net) Apache License 2.0 Provided functionality Supported Methods: Status, User, Direct message Authentication: Basic Auth Provides a Python wrapper around the Twitter API and data model Requirements simplejson (http://cheeseshop.python.org/pypi/simplejson) Folie 30 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 31. Twyt A Twitter API interface for Python Project information Project site: http://andrewprice.me.uk/projects/twyt/ Author: Andrew Price BSD License Provided functionality Supported Methods: Status, User, Direct Message, Friendship, Social Graph, Block Authentication: Basic Auth, OAuth Folie 31 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 32. twitty-twister A Twisted interface to Twitter Project information Project site: http://github.com/dustin/twitty-twister/tree/master Author: Dustin Sallings License: ? Provided functionality Supported methods: Status, User, Direct message, Friendship Authentication: Basic Auth, OAuth Folie 32 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 33. Python Twitter Tools (PTT) Twitter API, command-line tool, and IRC bot Project information Projekt site: http://mike.verdone.ca/twitter/ Author: Mike Verdone MIT License Provided functionality Supported methods: status, user, direct message Authentication: Basic Auth IRC bot that can announce Twitter updates to an IRC channel Requirements irclib (http://python-irclib.sourceforge.net) Folie 33 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 34. Comparison Python Twitter Libraries Library Supported API Supported Requirements Methods Authentication Python-twitter Status, User, Direct Basic Auth simplejson message Twyt Status, User, Direct Basic Auth, Message, OAuth Friendship, Social Graph, Block Twitty-twister Status, User, Direct Basic Auth, Twisted message, OAuth Friendship Python Status, User, Direct Basic Auth (irclib) Twitter Tools message Folie 34 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 35. Examples and Demos Folie 35 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 36. Example Get all Updates of a User import twitter api = twitter.Api() statuses = api.GetUserTimeline('DLR_de') print [s.text for s in statuses[:5]] [u"Video: @NASA's SOFIA mission update http://tinyurl.com/cmmna3 #SOFIA (Stratospheric Observatory For Infrared Astronomy)", u'Video zur GOCE-Mission (Messung der Schwerkraft) http://tinyurl.com/c5zhdb #euronews', u'(EN) Now following @ESAGermany and @ESAGOCE', u'@AndreasSchepers Gute Frage. Immerhin hat die NASA-Mission keinen Vornamen. #Johannes #ATV #NASA', u'RT @AndreasSchepers Thomas Reiter: Wir wissen mehr xfcber den Mars als den Mond. http://is.gd/k7qZ #Mp3 #DeutschlandRadioKultur #DLR-Vorstand'] Folie 36 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 37. Example Posting an Update import twitter api = twitter.Api(username='python_demo', password='***') api.PostUpdate('Moin!') Folie 37 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 38. Example Adding a Friend („Follow“) import twitter api = twitter.Api(username='python_demo', password='***') user = api.CreateFriendship('pycologne') print user {"description": "Python User Group Cologne", "id": 23515458, "location": "Cologne, Germany", "name": "PyCologne", "profile_image_url": "http://s3.amazonaws.com/twitter_production/profile_images/91413444/p ycologne_logo_small_quadratisch_normal.jpg", "screen_name": "pycologne", "url": "http://www.pycologne.de"} Folie 38 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 39. Example „tail –f“ to Twitter # based on http://code.activestate.com/recipes/157035/ import time, os import twitter api = twitter.Api(username='python_demo', password=‘***') file = open('test.log','r') # ... <Find the size of the file and move to the end> while 1: where = file.tell() line = file.readline() if not line: time.sleep(1) file.seek(where) else: api.PostUpdate(line) Folie 39 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 40. Example „tail –f“ to Twitter Folie 40 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 41. Demo Twitter in Software Engineering Notifications from SVNChecker (http://svnchecker.tigris.org/) Folie 41 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 42. Demo Twitter on Smart Phones Posting incoming SMS to Twitter account Folie 42 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009
  • 43. Demo Twitter Notification from MoinMoin Wiki Twitter handler for the MoinMoin Event System python-twitter Folie 43 EuroPython 2009 > Andreas Schreiber> Twittering with Python > 30.06.2009

Notes de l'éditeur

  1. EuroPython talk “Twittering with Python” by @onyame http://tr.im/schreiber #europython
  2. Follow this presentation @ python_demo
  3. Final version of this presentation is available on @slideshare http://tr.im/ep09twt
  4. What is Twitter? Summary from http://en.wikipedia.org/wiki/Twitter
  5. History of My Blog http://tr.im/pXOi by Hugh MacLeod @gapingvoid
  6. Many, many people are on Twitter, e.g. see http://tr.im/pXBr by @ timesonline
  7. Many many people are on Twitter! For examples, see http://tr.im/pXBr
  8. Guido „Creator of Python“ van Rossum on Twitter: @gvanrossum
  9. German Aerospace Center (DLR) on Twitter: @DLR_de
  10. The Open Source CMS Plone on Twitter: @plone
  11. Python Package Index on Twitter: @pypi #python
  12. BBC News on Twitter: @bbcbreaking (btw. I’m so sad about #michaeljackson)
  13. EuroPython on Twitter: @europython
  14. Supercomputing conference SC09 on Twitter: @SuperComputing
  15. http://twitter.com uses Ruby on Rails http://rubyonrails.org/
  16. I
  17. Search for hash tags, such as http://search.twitter.com/search?q=%23europython
  18. There are many Twitter application, see http://twitter.pbwiki.com/Apps
  19. Coming to the Twitter Application Programming Interface…
  20. Twitter has an REST-based API: http://apiwiki.twitter.com
  21. Twitter API methods include Status, Account, User, Direct Message, and Friendship …
  22. Twitter API methods include Favorite, Help, Notification, and Block
  23. Twitter supports Basic HTTP authentication and OAuth http://oauth.net/
  24. There are Twitter libraries for many languages http://apiwiki.twitter.com/Libraries … of course, we are interested in #python ;-)
  25. At least 4 Python Twitter libraries exist: http://tr.im/pytwitter http://tr.im/twyt http://tr.im/twittytwister http://tr.im/pytwittertools
  26. Library #1: python-twitter http://tr.im/pytwitter by Dewitt Clinton @dewitt
  27. API and Data model of python-twitter http://tr.im/pytwitter
  28. Library #2: Twyt http://tr.im/twyt by Andrew Price @andyprice
  29. API and Data model of Twyt http://tr.im/twyt
  30. Library #3: twitty-twister http://tr.im/twittytwister by Dustin Sallings @ dlsspy
  31. API and data model of twitty-twister http://tr.im/twittytwister
  32. Library #4: Python Twitter Tools (PTT) http://tr.im/pytwittertools by Mike Verdone @verdonethestone
  33. API and data model of Python Twitter Tools http://tr.im/pytwittertools
  34. Some simple examples for the Python Twitter Tools
  35. Direct comparison of all Python Twitter Libraries
  36. Now showing some examples and demos… #twitter #python
  37. Demo: Show recent updates of user @DLR_de
  38. Demo: Post an update… very simple ;-)
  39. Demo: Add the Python User Group Cologne @pycologne as a friend #köln
  40. The tail2twitter is an extension of http://code.activestate.com/recipes/157035
  41. tail2twitter can be used to monitor server log files.
  42. Demo: Notification from SVNChecker (see presentation from #europython 2008 http://tr.im/q38T)
  43. It’s easy to develop Twitter application on Smart phones with PyS60 http://tr.im/q4wm
  44. Demo: Slide change notification from Microsoft PowerPoint. If you read this message, the demo is successful!
  45. In Python, it’s very easy to catch the slide change event http://msdn.microsoft.com/en-us/library/bb231077.aspx
  46. For details see Roy Han’s #pycon tutorial Automating Windows Applications with win32com http://tr.im/q43o
  47. Demo: Twitter notification from MoinMoin Wiki http://moinmo.in/
  48. Thank You! For further contact: follow @onyame, visit http://tr.im/schreiber, or send E-Mail to python@dlr.de