Page 1 of 1
Uploading NZB With API.
Posted: May 9th, 2009, 2:49 pm
by andre_pl
I'm working on a PyQt Gui app for SAB, and I'm having a hard time with uploading nzb files. I've the perl example that was posted here a long time ago, but I'm looking for some sort of python example. I've tried all sorts of things from urllib and pycurl but haven't had any success. does anyone have an example of uploading an nzb file with python?
Re: Uploading NZB With API.
Posted: May 9th, 2009, 3:37 pm
by switch
The fileupload is a pretty painful thing to do with the api.
You can try using this library
http://fabien.seisen.org/python/urllib2_multipart.html
to send the nzb file, however personally I caved and just added an API function for version 0.5 that just requires the local file path to add to sabnzbd.
Code: Select all
-addlocalfile
http://localhost:8080/sabnzbd/api?mode=addlocalfile&name=c%3A%0Cile%20name.nzb
I'm quite interested in what you are working on, care to share more details or screenshots?
Re: Uploading NZB With API.
Posted: May 9th, 2009, 3:54 pm
by andre_pl
switch wrote:
The fileupload is a pretty painful thing to do with the api.
You can try using this library
http://fabien.seisen.org/python/urllib2_multipart.html
to send the nzb file, however personally I caved and just added an API function for version 0.5 that just requires the local file path to add to sabnzbd.
Code: Select all
-addlocalfile
http://localhost:8080/sabnzbd/api?mode=addlocalfile&name=c%3A%0Cile%20name.nzb
I'm quite interested in what you are working on, care to share more details or screenshots?
I dont have much yet, but What i want is just something that sits in the system tray, and can pop up a window showing the current queue, and allow dropping nzb files (or urls to nzb files) into the window to automatically add them to the queue. I have SABnzbd running on my server and i'll be running the gui app on the other computers in the house (one mac, one linux) so i'd really like to get the upload functionality working. the linux machine has the NZB Scan directory mounted, but the mac doesn't, so It would be really useful to get the upload functionality.
I actually did try the code you linked to and I couldn't get that to work either.

maybe i'm passing in the wrong variables or something, does the &name= have to match the name of the uploaded file?
when i have something more usable I'll post more info about it.
Re: Uploading NZB With API.
Posted: May 9th, 2009, 5:19 pm
by andre_pl
I was able to get the file uplaod to work using this code:
http://odin.himinbi.org/MultipartPostHandler.py
i should have some code to share some time tomorrow.