Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Python client for the API

Project Description


phishnetpy is a Python client for the API. It works with either Python 2 or 3 and supports all of the endpoints provided by


You guessed it…

pip install phishnetpy

Getting Started

As you browse the API documentation you will see that some API methods are labeled as “protected”. This means that in order to use those methods, you must generate an Application Key. To allow both public and protected usage, there are several setup steps you have to complete.

Public API Methods

For “public” or “unprotected” API calls, you simply need to instantiate the PhishNetAPI class, and call the methods for each of the API methods.

>>> from phishnetpy import PhishNetAPI
>>> phishnet = PhishNetAPI()
>>> artists = phishnet.artists_get()
>>> artists
[{'artist': 'Phish', 'slug': 'phish', 'artistid': '1'}, {'artist': 'Trey Anastasio', 'slug': 'trey-anastasio-band', 'artistid': '2'}, {'artist': 'Mike Gordon', 'slug': 'mike-gordon', 'artistid': '6'}, {'artist': 'Jon Fishman', 'slug': 'jon-fishman', 'artistid': '7'}, {'artist': 'Page McConnell', 'slug': 'page-mcconnell', 'artistid': '9'}]

Attempting to call protected methods without passing in an API key into the constructor will raise phishnetpy.exceptions.AuthError.

>>> phishnet.user_username_check("wilson")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./phishnetpy/phishnetpy/", line 16, in wrapper
    raise AuthError("{} requires an API key".format(qual_name_safe(f)))
phishnetpy.exceptions.AuthError: PhishNetAPI.user_username_check requires an API key

Protected API Methods

In order to collect “protected” API methods, you must pass an API key into the constuctor.

>>> from phishnetpy import PhishNetAPI
>>> my_api_key = "<MY API KEY>" # Private API key from
>>> phishnet = PhishNetAPI(api_key=my_api_key)
>>> phishnet.user_username_check("wilson")
{'success': '0', 'reason': 'Sorry! wilson is already taken.'}

Methods requiring user authorization

Some protected methods additionally require an auth_key to take actions on behalf of specific users. This includes submitting reviews, forum threads, or adding a show to “My Shows”.

phishnetpy can make generating auth codes simpler by adding some logic on top of the pnet.api.* API methods.

The simplest way is probably by using the authorize method. In order to make this method work, you will need both the username and password of the user you are authorizing (at least the first time).

>>> from phishnetpy import PhishNetAPI
>>> my_api_key = "<MY API KEY>" # Private API key from
>>> phishnet = PhishNetAPI(api_key=my_api_key)
>>> phishnet.authorize('authorized_username', 'that_users_password')

If unsuccessful, the phishnetpy.exceptions.AuthError will be raised. If successful, the authorized username and auth key will be stored as attributes on the instance you’re working with.

>>> phishnet.username
>>> phishnet.auth_key

Once those attributes have been set, you can make user-authorized API calls. For example, lets add, and then remove Halloween 2014 to my shows.

>>> len(phishnet.user_myshows_get_authorized())
>>> phishnet.user_myshows_add('2014-10-31')
{'success': 1}
>>> len(phishnet.user_myshows_get_authorized())
>>> phishnet.user_myshows_remove('2014-10-31')
{'success': 1}
>>> len(phishnet.user_myshows_get_authorized())

Once authorized, you should not store the user’s password (per the terms).

Release History

This version
History Node


History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(9.8 kB) Copy SHA256 Hash SHA256
Source None Sep 23, 2015

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers