jdorfman
jdorfman

Reputation: 811

Python xmlrpclib.Fault while using NetDNA's API

I am trying to write a Python script that will list all of my Pull Zones. Everytime I run the script I get the following error:

xmlrpclib.Fault: <Fault 620: 'Method "pullzone.list" does not exist'>

The documentation for List Zones is here: http://support.netdna.com/api/#pullzone.listZones

Here is the script:

#! /usr/bin/python

from xmlrpclib import ServerProxy
from hashlib import sha256
from datetime import datetime, timedelta
from pytz import timezone

apiKey = 'sldjlskdjf'
apiUserId = '0000'

def pullzoneListZones():
    global apiKey, apiUserId
    date = datetime.now(timezone('America/Los_Angeles')).replace(microsecond=0).isoformat() # Must be 'America/Los_Angeles' always!
    authString = sha256(date + ":" + apiKey + ":listZones").hexdigest()
    sp = ServerProxy('http://api.netdna.com/xmlrpc/pullzone')
    return sp.pullzone.list(apiUserId, authString, date)

print pullzoneListZones()

What am I missing? Thanks in advance. Disclaimer: I work for NetDNA but know one here knows Python.

Thanks in advance.

Upvotes: 1

Views: 196

Answers (1)

ajperella
ajperella

Reputation: 26

The method is wrongly named - it should be

sp.pullzone.listZones(apiUserId, authString, date)

See http://support.netdna.com/api/#Python for api names.

Upvotes: 1

Related Questions