wiki:Notes/PythonClients

Python Clients

General purpose clients ? Currently strewn all over the place ... need to collect here or maybe links to them.

Some servers have client libraries ?

STOMP

ttps://pypi.python.org/pypi/stomp.py

“stomp.py” is a Python client library for accessing messaging servers (such as ActiveMQ, Apollo or RabbitMQ) using the STOMP protocol (versions 1.0, 1.1 and 1.2). It can also be run as a standalone, command-line client for testing.

XMPP

PythonXMPP#SleekXMPP

PythonXMPP#PythonQpid

PythonOpenfire#SleekXMPP

PythonOpenfire#xmpppy

PythonOpenfire#PythonOpenfireModule

AMQP

PythonAMQP#Kombu

PythonAMQP#Celery

PythonAMQP#Carrot

PythonAMQP#Pika

Zero MQ

Official Python bindings - http://zeromq.org/bindings:python

http://blog.pythonisito.com/2012/08/distributed-systems-with-zeromq.html

Python examples

One of the first things to understand about ZeroMQ is that it's not a message broker like you might assume from its name. ZeroMQ is a library that supports certain network communication patterns using sockets ...

ZeroMQ uses queues internally to buffer messages so that you don't block your application when sending data. When you say socket.send(...), ZeroMQ actually enqueues a message to be sent later by a dedicated communication thread.

http://blog.jupo.org/2013/02/23/a-tale-of-two-queues/

Without further ado, here’s a basic pub-sub message broker in Python using ZeroMQ, that demonstrates how little is required to get up and running:

http://nichol.as/zeromq-an-introduction

... I will show how to design and implement a messaging layer with ZeroMQ. For the code example I will use Brian Granger’s PyZMQ, which is the excellent Python binding to ZeroMQ.

https://github.com/zeromq/pyzmq

This package contains Python bindings for ØMQ. ØMQ is a lightweight and fast messaging implementation.

Is both client and server.

Tons of examples - https://github.com/imatix/zguide/tree/master/examples/Python

See Messaging#ZeroMQ, PythonServers#ZeroMQ

MQTT

See Messaging#MQTT

Paho MQTT

https://pypi.python.org/pypi/paho-mqtt

This code provides a client class which enable applications to connect to an MQTT broker to publish messages, and to subscribe to topics and receive published messages. It also provides some helper functions to make publishing one off messages to an MQTT server very straightforward ...

Here is a very simple example that subscribes to the broker $SYS topic tree and prints out the resulting messages:

import paho.mqtt.client as mqtt

# The callback for when the client receives a CONNACK response from the server.
def on_connect(client, userdata, flags, rc):
    print("Connected with result code "+str(rc))

    # Subscribing in on_connect() means that if we lose the connection and
    # reconnect then subscriptions will be renewed.
    client.subscribe("$SYS/#")

# The callback for when a PUBLISH message is received from the server.
def on_message(client, userdata, msg):
    print(msg.topic+" "+str(msg.payload))

client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message

client.connect("iot.eclipse.org", 1883, 60)

# Blocking call that processes network traffic, dispatches callbacks and
# handles reconnecting.
# Other loop*() functions are available that give a threaded interface and a
# manual interface.
client.loop_forever()

http://eclipse.org/paho/

The Paho project provides open-source client implementations of open and standard messaging protocols aimed at new, existing, and emerging applications for Machine‑to‑Machine (M2M) and Internet of Things (IoT).

https://www.eclipse.org/paho/clients/python/

The Paho Python Client provides a client class with support for both MQTT v3.1 and v3.1.1 on Python 2.7 or 3.x. It also provides some helper functions to make publishing one off messages to an MQTT server very straightforward.

Mosqitto MQTT Client

http://jpmens.net/2013/02/25/lots-of-messages-mqtt-pub-sub-and-the-mosquitto-broker/

A small Python program connects to the broker and subscribes to a few topics:

Lots of general articles about messaging

#!/usr/bin/env python

import mosquitto

def on_message(mosq, obj, msg):
    print "%-20s %d %s" % (msg.topic, msg.qos, msg.payload)

    mosq.publish('pong', "Thanks", 0)

def on_publish(mosq, obj, mid):
    pass

cli = mosquitto.Mosquitto()
cli.on_message = on_message
cli.on_publish = on_publish

cli.tls_set('root.ca',
    certfile='c1.crt',
    keyfile='c1.key')

cli.connect("hippo", 1883, 60)

cli.subscribe("dns/all", 0)
cli.subscribe("nagios/#", 0)

while cli.loop() == 0:
    pass

WebDAV

https://github.com/amnong/easywebdav

Basic authentication

Creating directories, removing directories and files

Uploading and downloading files

Directory listing

Support for client side SSL certificates

https://pypi.python.org/pypi/easywebdav/

Tiny, no external dependencies. Latest release 2014.

https://github.com/scaryclam/python-webdav

No release 5 years.

https://launchpad.net/python-webdav-lib

This project aims to provide an object-oriented Python WebDAV client-side library based on Pythons standard httplib and Greg Steins davlib. The client shall fully support RFCs 4918 (basic specification), 3744 (access control), and 3253 (versioning).

http://bazaar.launchpad.net/~datafinder-team/python-webdav-lib/trunk/files

Recommended, but 2012 ?

http://chandlerproject.org/Projects/Davclient

2009 ???

https://pypi.python.org/pypi?%3Aaction=search&term=webdav&submit=search

https://pypi.python.org/pypi/webdavclient/1.0.3

Hablo Russki ???

https://github.com/designerror/webdavclient-python

https://pypi.python.org/pypi/Python_WebDAV_Library/0.4.2

This library provides a WebDAV client including ACP and searching support.

2012 ?

https://pypi.python.org/pypi/PyDAV/0.21

2006 !!''

https://pypi.python.org/pypi/tinydav/0.7.4.1

An easy-to-use HTTP and WebDAV client library.

This is a small library for contacting HTTP and WebDAV servers. Goal of this project until version 1.0 is supporting all WebDAV methods including the versioning extensions from RFC 3253).

Features:

HTTP methods OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT.
WebDAV methods MKCOL, PROPFIND, PROPPATCH, DELETE, COPY, MOVE, LOCK, UNLOCK
Support for REPORT method (verion-tree and expand-property, RFC 3253)
Cookies
SSL
Multipart/form-data and application/x-www-form-urlencoded POST requests

This version requires Python 2.5 or later (including Python 3.)

https://code.google.com/p/tinydav

https://code.google.com/p/tinydav/source/browse/

Apparently current, says 2015, but actually last release is 2012.

https://code.google.com/p/tinydav/wiki/Tutorial

https://code.google.com/p/tinydav/wiki/tinydav

https://code.google.com/p/tinydav/downloads/list

Downloads form 2012, but apparently the most usable.

Samba

Still not sure about using Samba as a major component for PyWacket integration, more like find an alternative solution for the File Server functional slot.

Maybe 'reverse engineer' a functional replacement that works with existing Python Samba clients ... is anybody using them in the first place ?

See Servers#SambaServer.

https://pypi.python.org/pypi/pysmbc/

This is a set of Python bindings for the libsmbclient library from the samba project.

https://pypi.python.org/pypi/pysmb

pysmb is an experimental SMB/CIFS library written in Python. It implements the client-side SMB/CIFS protocol which allows your Python application to access and transfer files to/from SMB/CIFS shared folders like your Windows file sharing and Samba folders.

PySMB Documentation - http://pythonhosted.org//pysmb/

pysmb is a pure Python implementation of the client-side SMB/CIFS protocol (SMB1 and SMB2) which is the underlying protocol that facilitates file sharing and printing between Windows machines, as well as with Linux machines via the Samba server application.

pysmb is developed in Python 2.4.6, Python 2.7.1 and Python 3.2.3 and has been tested against shared folders on Windows XP SP3, Windows Vista, Windows 7 and Samba 3.x.

https://packages.debian.org/sid/python-samba https://packages.debian.org/wheezy/python-samba

amba is an implementation of the SMB/CIFS protocol for Unix systems, providing support for cross-platform file sharing with Microsoft Windows, OS X, and other Unix systems. Samba can also function as a domain controller or member server in both NT4-style and Active Directory domains.

This package contains Python bindings for most Samba libraries.

http://sourceforge.net/projects/pysamba/

PySamba? is a full wrapper based in the work of Tim Potter. PySamba? is built as a Python C extension and a Python module that hides the complexity of the lower layer (smb). At now, PySamba? provides a fully functional samba wrapper

https://www.novell.com/products/linuxpackages/enterpriseserver/i386/samba-python.html

What is it ?

http://stackoverflow.com/questions/986730/using-pysmbc-to-read-files-over-samba

Also See

http://pubsub.sourceforge.net/

http://sourceforge.net/projects/pubsub/

PyPubSub provides a publish - subscribe API that facilitates the development of event-based (also known as message-based) applications.

PyPubSub supports sending and receiving messages between objects of an application, as well as a variety of advanced features that facilitate debugging and maintaining topics and messages in larger applications.

See PythonServers

Last modified 3 years ago Last modified on 05/15/2015 05:35:01 PM