Uploading NZB With API.

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
andre_pl
Release Testers
Release Testers
Posts: 11
Joined: May 9th, 2009, 2:46 pm

Uploading NZB With API.

Post 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?
User avatar
switch
Moderator
Moderator
Posts: 1380
Joined: January 17th, 2008, 3:55 pm
Location: UK

Re: Uploading NZB With API.

Post 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?
andre_pl
Release Testers
Release Testers
Posts: 11
Joined: May 9th, 2009, 2:46 pm

Re: Uploading NZB With API.

Post 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.
Last edited by andre_pl on May 9th, 2009, 3:58 pm, edited 1 time in total.
andre_pl
Release Testers
Release Testers
Posts: 11
Joined: May 9th, 2009, 2:46 pm

Re: Uploading NZB With API.

Post 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.
Post Reply