[Spacewalk-list] help with api

wm-lists wm-lists at nixpeeps.com
Wed Oct 30 16:41:40 UTC 2013


I switched from perl to python for all my api scripts about 3 months ago,
and am working through my existing perl scripts to convert them to python.
python's much easier for working w/ the API as far as I've found...

You probably already know this, but if you are manually inputting the key,
don't forget to include the prefix (1- in my case) to the key..  If you are
using listActivationKeys you should get it anyway with the 'key'.




On Wed, Oct 30, 2013 at 11:33 AM, Maria Iano <maria at purplecoffee.com> wrote:

> On Wed, Oct 30, 2013 at 09:40:12AM -0400, wm-lists wrote:
> > Can you provide the request you are using? I just tested on Satellite 5.5
> > using the following and it seems to work ok for me
> >
> >     EKEYS = client.activationkey.listActivationKeys(seskey)
> >                 for EKEY in EKEYS:
> >                         if  EKEY.get('description') == KEY_NAME:
> >                                 print "Getting Key Details" + KEY_NAME
> >                                 DETAILS =
> > client.activationkey.getDetails(seskey,EKEY.get('key'))
> >                                 print DETAILS.get('description') + " " +
> > DETAILS.get('key') + " " + str(DETAILS.get('usage_limit'))
> >
> >
> > Getting Key Detailsact-pci-vdc-unit-rhel6-x86_64
> > act-pci-vdc-unit-rhel6-x86_64 1-act-pci-vdc-unit-rhel6-x86_64 0
> > complete
> >
>
> Thanks, it's useful to hear it does work in python. Here is how I call the
> api in my script for a single key.
>
> my $key = $opt_a;
> # my $key = $client->string($opt_a); # this didn't work either
> my $details = $client->call('activationkey.getDetails', $session, $key);
>
> At least I now have a workaround of doing it in python with a chunk of
> working code to start from.
>
> Thanks,
> Maria
>
> _______________________________________________
> Spacewalk-list mailing list
> Spacewalk-list at redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/spacewalk-list/attachments/20131030/127ab771/attachment.htm>


More information about the Spacewalk-list mailing list