SlideShare a Scribd company logo
1 of 18
a presentation by Marek Kuziel < [email_address] > Djabot – Python Jabber Bot +  Echo  &  HTTP-like JSON API  Bots +  djabotd  – Django daemon command
track l r .com Marek Kuziel < [email_address] > #my #experience #in #hashtags #... #opensource #php #python #java #javascript  #html  #xhtml #docbook #xslt #css #linux #nginx #postgresql #mysql #memcache  #apache  #subversion #mercurial #phing #pear #deployment #scaling #automation  #tomcat  #javaws  #arduino #8051 #Z80 #assembly #GWT #drupal #django #wsgi  #jabber  #xmpp  #thegimp #openid #oauth #ecommerce #zencart #titanium #mobile #tracklr #tracklr2mindmap #djauthy #djabot Djabot – Python Jabber Bot
Jabber/XMPP track l r .com Djabot – Python Jabber Bot Good security – TLS support Decentralized – You can run your own Jabber/XMPP server Open – Standards, community, code
What Is a Jabber Bot? track l r .com Djabot – Python Jabber Bot An unmanned Jabber/XMPP client Runs as a program on a computer (ie. as a Linux daemon) Processes incoming messages from other clients
Introducing Djabot track l r .com Djabot – Python Jabber Bot Python Jabber client – TLS support, extensible (bots, auth) Example bots:  echo ,  HTTP-like JSON API djabotd  – Django command that implements Djabot and  allows you to run bots for your Django based app  as a daemon
Djabot – More Information track l r .com Djabot – Python Jabber Bot Requires: PyXMPP, M2Crypto, libxml2-python, dnspython Allows you to provide your own auth callback function to  protect your bots Allows you to write as many bots as you like and  configure your instance to use them
Djabot – Example Code track l r .com Djabot – Python Jabber Bot #/usr/bin/env python from pyxmpp.all import JID from djabot.djabot import Client if __name__ == '__main__: def auth_check(requestSenderJID): return True  # reply to any sender / do not check sender's JID at all BOTS = ['djabot.bots.echo'] c=Client(JID('USERNAME'), 'PASSWORD', 'tls_noverify', BOTS, auth_check) c.connect() c.loop(1)
Djabot – Example Echo Bot Code track l r .com Djabot – Python Jabber Bot from djabot.bots.base import Djabot as Base class Djabot(Base): NAME = 'djabot-echo-bot' def command_echo(self, inputs): return inputs['body'] def status(self, inputs): return 'echoed back: echo %s' % inputs['body']
Djabot commands –  inputs track l r .com Djabot – Python Jabber Bot djabot processes received Jabber msg & passes the following dictionary as  inputs  parameter to any  command that you define: inputs = { 'subject': subject,  # subject of received msg 'body': body,  # body of received msg  'body_json': None, #  JSON object ( if possible to load body as JSON) 'jid': sender,  # JID of sender }
Jabber/XMPP HTTP-like JSON API track l r .com Djabot – Python Jabber Bot What? request/response JSON API over Jabber/XMPP that mimics HTTP (status code; PUT|POST|GET|DELETE verbs) Why? I prefer “chatting” with my app instead of RESTful  HTTP based approach Seriously. Why? Faster & easier implementation of APIs
Core properties of the API protocol track l r .com Djabot – Python Jabber Bot HTTP  status   code  and  message  property in response  transaction  property to uniquely identify sent/received messages api  property for version namespace of given  action property in request
“ GTalk – djabot” example chat about  GET track l r .com Djabot – Python Jabber Bot me:   {&quot;action&quot;: &quot;GET&quot;, &quot;api&quot;: &quot;1.0&quot;,  &quot;data&quot;: {&quot;id&quot;: &quot;123&quot;}, &quot;object&quot;: &quot;OBJECT&quot;,  &quot;transaction&quot;: &quot;1234567890&quot;} djabot:   {'message': u'GET OBJECT ID 123 OK', 'code': '200', 'data': '{&quot;id&quot;: &quot;123&quot;, &quot;example_data&quot;: &quot;EXAMPLE&quot;}',  'transaction': u'1234567890'}
“ GTalk – djabot” example chat about  PUT track l r .com Djabot – Python Jabber Bot me:   {&quot;action&quot;: &quot;PUT&quot;, &quot;api&quot;: &quot;1.0&quot;,  &quot;data&quot;: {&quot;id&quot;: 123}, &quot;object&quot;: &quot;OBJECT&quot;, &quot;transaction&quot;: &quot;1234567890&quot;} djabot:   {'message': u'PUT OBJECT ID 123 OK', 'code': '200', 'transaction':  u'1234567890'}
“ GTalk – djabot” example chat about  POST track l r .com Djabot – Python Jabber Bot me:   {&quot;action&quot;: &quot;POST&quot;, &quot;api&quot;: &quot;1.0&quot;,  &quot;data&quot;: {&quot;id&quot;: 123}, &quot;object&quot;: &quot;OBJECT&quot;, &quot;transaction&quot;: &quot;1234567890&quot;} djabot:   {'message': u'POST OBJECT ID 123 OK', 'code': '200', 'transaction':  u'1234567890'}
“ GTalk – djabot” example chat about  DELETE track l r .com Djabot – Python Jabber Bot me:   {&quot;action&quot;: &quot;DELETE&quot;, &quot;api&quot;: &quot;1.0&quot;,  &quot;data&quot;: {&quot;id&quot;: 123}, &quot;object&quot;: &quot;OBJECT&quot;, &quot;transaction&quot;: &quot;1234567890&quot;} djabot:   {'message': u'DELETE OBJECT ID 123 OK', 'code': '200', 'transaction':  u'1234567890'}
Demo HTTP-like JSON API Bot track l r .com Djabot – Python Jabber Bot [email_address] Try it :-)
Djabot – Source Code track l r .com Djabot – Python Jabber Bot Released 2010/07/17 under BSD License http://bitbucket.org/vshivak/djabot/ Feedback or contributions: Marek Kuziel < [email_address] >
Thank Yo u ! Marek Kuziel, Christchurch, New Zealand, July 2010 This presentation can be found at  http://tracklr.com/tm/presentations/tracklr-djabot.pdf

More Related Content

What's hot

Painless Data Storage with MongoDB & Go
Painless Data Storage with MongoDB & Go Painless Data Storage with MongoDB & Go
Painless Data Storage with MongoDB & Go Steven Francia
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...Guillaume Laforge
 
Go for Object Oriented Programmers or Object Oriented Programming without Obj...
Go for Object Oriented Programmers or Object Oriented Programming without Obj...Go for Object Oriented Programmers or Object Oriented Programming without Obj...
Go for Object Oriented Programmers or Object Oriented Programming without Obj...Steven Francia
 
Boost Maintainability
Boost MaintainabilityBoost Maintainability
Boost MaintainabilityMosky Liu
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page CreationWildan Maulana
 
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)James Titcumb
 
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)James Titcumb
 
Elegant concurrency
Elegant concurrencyElegant concurrency
Elegant concurrencyMosky Liu
 
Making JavaScript Libraries More Approachable
Making JavaScript Libraries More ApproachableMaking JavaScript Libraries More Approachable
Making JavaScript Libraries More ApproachablePamela Fox
 
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019Viktor Todorov
 
Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Servicesmattjive
 
Php Extensions for Dummies
Php Extensions for DummiesPhp Extensions for Dummies
Php Extensions for DummiesElizabeth Smith
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS charsbar
 
Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to Rubykim.mens
 
JavaScript, Beyond the Curly Braces
JavaScript, Beyond the Curly BracesJavaScript, Beyond the Curly Braces
JavaScript, Beyond the Curly BracesChicago ALT.NET
 

What's hot (20)

Painless Data Storage with MongoDB & Go
Painless Data Storage with MongoDB & Go Painless Data Storage with MongoDB & Go
Painless Data Storage with MongoDB & Go
 
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
JavaOne 2008 - TS-5793 - Groovy and Grails, changing the landscape of Java EE...
 
Go for Object Oriented Programmers or Object Oriented Programming without Obj...
Go for Object Oriented Programmers or Object Oriented Programming without Obj...Go for Object Oriented Programmers or Object Oriented Programming without Obj...
Go for Object Oriented Programmers or Object Oriented Programming without Obj...
 
Boost Maintainability
Boost MaintainabilityBoost Maintainability
Boost Maintainability
 
Learn php with PSK
Learn php with PSKLearn php with PSK
Learn php with PSK
 
The Basics Of Page Creation
The Basics Of Page CreationThe Basics Of Page Creation
The Basics Of Page Creation
 
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)
Low Latency Logging with RabbitMQ (Brno PHP, CZ - 20th Sep 2014)
 
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
Low Latency Logging with RabbitMQ (PHP London - 4th Sep 2014)
 
Elegant concurrency
Elegant concurrencyElegant concurrency
Elegant concurrency
 
Php tutorial
Php tutorialPhp tutorial
Php tutorial
 
Php performance
Php performancePhp performance
Php performance
 
Introduction to php basics
Introduction to php   basicsIntroduction to php   basics
Introduction to php basics
 
Making JavaScript Libraries More Approachable
Making JavaScript Libraries More ApproachableMaking JavaScript Libraries More Approachable
Making JavaScript Libraries More Approachable
 
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
The Recording HTTP Proxy: Not Yet Another Messiah - Bulgaria PHP 2019
 
Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Services
 
Php Extensions for Dummies
Php Extensions for DummiesPhp Extensions for Dummies
Php Extensions for Dummies
 
typemap in Perl/XS
typemap in Perl/XS  typemap in Perl/XS
typemap in Perl/XS
 
Php string function
Php string function Php string function
Php string function
 
Introduction to Ruby
Introduction to RubyIntroduction to Ruby
Introduction to Ruby
 
JavaScript, Beyond the Curly Braces
JavaScript, Beyond the Curly BracesJavaScript, Beyond the Curly Braces
JavaScript, Beyond the Curly Braces
 

Similar to Djabot – Python Jabber Bot

Real-time Ruby for the Real-time Web
Real-time Ruby for the Real-time WebReal-time Ruby for the Real-time Web
Real-time Ruby for the Real-time WebIlya Grigorik
 
Ruby as a glue language
Ruby as a glue languageRuby as a glue language
Ruby as a glue languagequakewang
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesciklum_ods
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTPMykhailo Kolesnyk
 
Enterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript DevelopersEnterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript DevelopersAndreCharland
 
Teflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surfaceTeflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surfaceSaumil Shah
 
Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3Alex Kavanagh
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009marpierc
 
Comet web applications with Python, Django & Orbited
Comet web applications with Python, Django & OrbitedComet web applications with Python, Django & Orbited
Comet web applications with Python, Django & OrbitedPyCon Italia
 
Comet web applications with Python, Django & Orbited
Comet web applications with Python, Django & OrbitedComet web applications with Python, Django & Orbited
Comet web applications with Python, Django & Orbitedskam
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax componentsIgnacio Coloma
 
Atlrug intermodal - sep 2011
Atlrug   intermodal - sep 2011Atlrug   intermodal - sep 2011
Atlrug intermodal - sep 2011hosheng
 
Mashups & APIs
Mashups & APIsMashups & APIs
Mashups & APIsPamela Fox
 
Exploiting the newer perl to improve your plugins
Exploiting the newer perl to improve your pluginsExploiting the newer perl to improve your plugins
Exploiting the newer perl to improve your pluginsMarian Marinov
 

Similar to Djabot – Python Jabber Bot (20)

Real-time Ruby for the Real-time Web
Real-time Ruby for the Real-time WebReal-time Ruby for the Real-time Web
Real-time Ruby for the Real-time Web
 
Ruby as a glue language
Ruby as a glue languageRuby as a glue language
Ruby as a glue language
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTP
 
Enterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript DevelopersEnterprise AIR Development for JavaScript Developers
Enterprise AIR Development for JavaScript Developers
 
Teflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surfaceTeflon - Anti Stick for the browser attack surface
Teflon - Anti Stick for the browser attack surface
 
Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3Real time web (Orbited) at BCNE3
Real time web (Orbited) at BCNE3
 
GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009GTLAB Installation Tutorial for SciDAC 2009
GTLAB Installation Tutorial for SciDAC 2009
 
Comet web applications with Python, Django & Orbited
Comet web applications with Python, Django & OrbitedComet web applications with Python, Django & Orbited
Comet web applications with Python, Django & Orbited
 
PSGI/Plack OSDC.TW
PSGI/Plack OSDC.TWPSGI/Plack OSDC.TW
PSGI/Plack OSDC.TW
 
Grails and Dojo
Grails and DojoGrails and Dojo
Grails and Dojo
 
Comet web applications with Python, Django & Orbited
Comet web applications with Python, Django & OrbitedComet web applications with Python, Django & Orbited
Comet web applications with Python, Django & Orbited
 
Rack Middleware
Rack MiddlewareRack Middleware
Rack Middleware
 
Fantom and Tales
Fantom and TalesFantom and Tales
Fantom and Tales
 
WordPress APIs
WordPress APIsWordPress APIs
WordPress APIs
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
 
Atlrug intermodal - sep 2011
Atlrug   intermodal - sep 2011Atlrug   intermodal - sep 2011
Atlrug intermodal - sep 2011
 
REST dojo Comet
REST dojo CometREST dojo Comet
REST dojo Comet
 
Mashups & APIs
Mashups & APIsMashups & APIs
Mashups & APIs
 
Exploiting the newer perl to improve your plugins
Exploiting the newer perl to improve your pluginsExploiting the newer perl to improve your plugins
Exploiting the newer perl to improve your plugins
 

Recently uploaded

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 

Recently uploaded (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Djabot – Python Jabber Bot

  • 1. a presentation by Marek Kuziel < [email_address] > Djabot – Python Jabber Bot + Echo & HTTP-like JSON API Bots + djabotd – Django daemon command
  • 2. track l r .com Marek Kuziel < [email_address] > #my #experience #in #hashtags #... #opensource #php #python #java #javascript #html #xhtml #docbook #xslt #css #linux #nginx #postgresql #mysql #memcache #apache #subversion #mercurial #phing #pear #deployment #scaling #automation #tomcat #javaws #arduino #8051 #Z80 #assembly #GWT #drupal #django #wsgi #jabber #xmpp #thegimp #openid #oauth #ecommerce #zencart #titanium #mobile #tracklr #tracklr2mindmap #djauthy #djabot Djabot – Python Jabber Bot
  • 3. Jabber/XMPP track l r .com Djabot – Python Jabber Bot Good security – TLS support Decentralized – You can run your own Jabber/XMPP server Open – Standards, community, code
  • 4. What Is a Jabber Bot? track l r .com Djabot – Python Jabber Bot An unmanned Jabber/XMPP client Runs as a program on a computer (ie. as a Linux daemon) Processes incoming messages from other clients
  • 5. Introducing Djabot track l r .com Djabot – Python Jabber Bot Python Jabber client – TLS support, extensible (bots, auth) Example bots: echo , HTTP-like JSON API djabotd – Django command that implements Djabot and allows you to run bots for your Django based app as a daemon
  • 6. Djabot – More Information track l r .com Djabot – Python Jabber Bot Requires: PyXMPP, M2Crypto, libxml2-python, dnspython Allows you to provide your own auth callback function to protect your bots Allows you to write as many bots as you like and configure your instance to use them
  • 7. Djabot – Example Code track l r .com Djabot – Python Jabber Bot #/usr/bin/env python from pyxmpp.all import JID from djabot.djabot import Client if __name__ == '__main__: def auth_check(requestSenderJID): return True # reply to any sender / do not check sender's JID at all BOTS = ['djabot.bots.echo'] c=Client(JID('USERNAME'), 'PASSWORD', 'tls_noverify', BOTS, auth_check) c.connect() c.loop(1)
  • 8. Djabot – Example Echo Bot Code track l r .com Djabot – Python Jabber Bot from djabot.bots.base import Djabot as Base class Djabot(Base): NAME = 'djabot-echo-bot' def command_echo(self, inputs): return inputs['body'] def status(self, inputs): return 'echoed back: echo %s' % inputs['body']
  • 9. Djabot commands – inputs track l r .com Djabot – Python Jabber Bot djabot processes received Jabber msg & passes the following dictionary as inputs parameter to any command that you define: inputs = { 'subject': subject, # subject of received msg 'body': body, # body of received msg 'body_json': None, # JSON object ( if possible to load body as JSON) 'jid': sender, # JID of sender }
  • 10. Jabber/XMPP HTTP-like JSON API track l r .com Djabot – Python Jabber Bot What? request/response JSON API over Jabber/XMPP that mimics HTTP (status code; PUT|POST|GET|DELETE verbs) Why? I prefer “chatting” with my app instead of RESTful HTTP based approach Seriously. Why? Faster & easier implementation of APIs
  • 11. Core properties of the API protocol track l r .com Djabot – Python Jabber Bot HTTP status code and message property in response transaction property to uniquely identify sent/received messages api property for version namespace of given action property in request
  • 12. “ GTalk – djabot” example chat about GET track l r .com Djabot – Python Jabber Bot me: {&quot;action&quot;: &quot;GET&quot;, &quot;api&quot;: &quot;1.0&quot;, &quot;data&quot;: {&quot;id&quot;: &quot;123&quot;}, &quot;object&quot;: &quot;OBJECT&quot;, &quot;transaction&quot;: &quot;1234567890&quot;} djabot: {'message': u'GET OBJECT ID 123 OK', 'code': '200', 'data': '{&quot;id&quot;: &quot;123&quot;, &quot;example_data&quot;: &quot;EXAMPLE&quot;}', 'transaction': u'1234567890'}
  • 13. “ GTalk – djabot” example chat about PUT track l r .com Djabot – Python Jabber Bot me: {&quot;action&quot;: &quot;PUT&quot;, &quot;api&quot;: &quot;1.0&quot;, &quot;data&quot;: {&quot;id&quot;: 123}, &quot;object&quot;: &quot;OBJECT&quot;, &quot;transaction&quot;: &quot;1234567890&quot;} djabot: {'message': u'PUT OBJECT ID 123 OK', 'code': '200', 'transaction': u'1234567890'}
  • 14. “ GTalk – djabot” example chat about POST track l r .com Djabot – Python Jabber Bot me: {&quot;action&quot;: &quot;POST&quot;, &quot;api&quot;: &quot;1.0&quot;, &quot;data&quot;: {&quot;id&quot;: 123}, &quot;object&quot;: &quot;OBJECT&quot;, &quot;transaction&quot;: &quot;1234567890&quot;} djabot: {'message': u'POST OBJECT ID 123 OK', 'code': '200', 'transaction': u'1234567890'}
  • 15. “ GTalk – djabot” example chat about DELETE track l r .com Djabot – Python Jabber Bot me: {&quot;action&quot;: &quot;DELETE&quot;, &quot;api&quot;: &quot;1.0&quot;, &quot;data&quot;: {&quot;id&quot;: 123}, &quot;object&quot;: &quot;OBJECT&quot;, &quot;transaction&quot;: &quot;1234567890&quot;} djabot: {'message': u'DELETE OBJECT ID 123 OK', 'code': '200', 'transaction': u'1234567890'}
  • 16. Demo HTTP-like JSON API Bot track l r .com Djabot – Python Jabber Bot [email_address] Try it :-)
  • 17. Djabot – Source Code track l r .com Djabot – Python Jabber Bot Released 2010/07/17 under BSD License http://bitbucket.org/vshivak/djabot/ Feedback or contributions: Marek Kuziel < [email_address] >
  • 18. Thank Yo u ! Marek Kuziel, Christchurch, New Zealand, July 2010 This presentation can be found at http://tracklr.com/tm/presentations/tracklr-djabot.pdf