Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A gevent based python client for NSQ.

Project description Documentation Status

A gevent based python client for NSQ distributed messaging platform.

Features include:

  • Free software: BSD license
  • Documentation:
  • Battle tested on billions and billions of messages </sagan>
  • Based on gevent for fast concurrent networking
  • Fast and flexible signals with Blinker
  • Automatic nsqlookupd discovery and back-off
  • Support for TLS, DEFLATE, and Snappy
  • Full HTTP clients for both nsqd and nsqlookupd


At the command line:

$ easy_install gnsq

Or even better, if you have virtualenvwrapper installed:

$ mkvirtualenv gnsq
$ pip install gnsq

Currently there is support for Python 2.7+, Python 3.4+ and PyPy.


First make sure nsq is installed and running. Next create a producer and publish some messages to your topic:

import gnsq

producer = gnsq.Producer('localhost:4150')

producer.publish('topic', 'hello gevent!')
producer.publish('topic', 'hello nsq!')

Then create a Consumer to consume messages from your topic:

consumer = gnsq.Consumer('topic', 'channel', 'localhost:4150')

def handler(consumer, message):
    print 'got message:', message.body



For NSQ 1.0 and later, use the major version 1 (1.x.y) of gnsq.

For NSQ 0.3.8 and earlier, use the major version 0 (0.x.y) of the library.

The recommended way to set your requirements in your or requirements.txt is:

# NSQ 1.x.y

# NSQ 0.x.y


Optional snappy support depends on the python-snappy package which in turn depends on libsnappy:

# Debian
$ sudo apt-get install libsnappy-dev

# Or OS X
$ brew install snappy

# And then install python-snappy
$ pip install python-snappy


Feedback, issues, and contributions are always gratefully welcomed. See the contributing guide for details on how to help and setup a development environment.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for gnsq, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size gnsq-1.0.2-py2.py3-none-any.whl (32.7 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size gnsq-1.0.2.tar.gz (46.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page