This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

NZB is an XML-based file format for retrieving posts from NNTP (Usenet)
Since NZB is XML-based, it's relatively easy to build one-off parsers to parse
NZB files. This project is an attempt to consolidate those many one-off NZB
parsers into one simple interface.

This package includes three implementations: one based on expat, another
on ElementTree, and a final implementation based on lxml. The order in which
they were listed is in order of compatibility. The expat version should work on
all versions of Python > 2.0, the lxml one will work on all versions > 2.5, and
lxml will only work if you have lxml installed.

A Note on Installing lxml

While lxml is not a requirement, I have had a hard time installing lxml in the
past. I have found this set of commands to work perfectly::

STATIC_DEPS=true easy_install 'lxml>=2.2beta4'
STATIC_DEPS=true sudo easy_install 'lxml>=2.2beta4'

API Documentation

Accessing the Default Parser

Simply import nzb_parser from the pynzb package. It's an instantiated version
of the fastest available parser that your system can support.

Other Parser Locations

Available in the ``pynzb.expat_nzb`` namespace.

Available in the ``pynzb.etree_nzb`` namespace.

Available in the ``pynzb.lxml_nzb`` namespace.

Using the NZB Parser

If you're using a specific parser, like the ``ETreeNZBParser``, you will first
have to instantiate it::

nzb_parser = ETreeNZBParser()

Otherwise, you can just import the default parser for your system::

from pynzb import nzb_parser

Then, simply call the ``parse`` method, giving it the xml string as the only

files = nzb_parser.parse('')

This will return a list of ``NZBFiles`` for you to use.

NZBFile Objects

All of the parsers return ``NZBFile`` objects, which are objects with the
following properties:

The name of the user who posted the file to the newsgroup.

A ```` representation of when the server first saw the file.

The subject used when the user posted the file to the newsgroup.

A list of strings representing the newsgroups in which this file may be

A list of ``NZBSegment`` objects talking about where to get the contents
of this file.

NZBSegment Objects

Each ``NZBFile`` has a list of ``NZBSegment`` objects, which include
on how to retrieve a part of a file. Here's what you can find on an
``NZBSegment`` object:

The number of the segment in the list of files.

The size of the segment, in bytes.

The Message-ID of the segment (useful for retrieving the full contents)


In this example, we will grab an Ubuntu NZB and parse the file, printing out
some information about each file and its segments::

from pynzb import nzb_parser
from urllib2 import urlopen

# Grab a sample Ubuntu NZB
ubuntu_nzb = urlopen('

# Parse the NZB into files
files = nzb_parser.parse(ubuntu_nzb)

# Print out each file's subject and the first two segment message ids
for nzb_file in files:
print nzb_file.subject
for segment in nzb_file.segments[:2]:
print ' ' + segment.message_id
if len(nzb_file.segments) > 2:
print ' ...'
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pynzb-0.1.0.tar.gz (5.6 kB) Copy SHA256 Checksum SHA256 Source May 11, 2009

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting