Skip to content

Latest commit

 

History

67 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qbit

GoDoc Go Report Card MIT License

Go library to interact with the qBittorrent Web API.

This is not a full client. It covers login (including HTTP basic auth), listing transfers, listing categories, and setting a torrent category. If you need more of the API, please open an issue or a pull request.

This library is used by Notifiarr.

qBittorrent 5.2+ returns HTTP 204 on login and other empty WebAPI responses. Older 200/Ok. logins still work.

Install

go get golift.io/qbit

Example

package main

import (
	"context"
	"log"
	"net/http"
	"time"

	"golift.io/qbit"
)

func main() {
	q, err := qbit.New(context.Background(), &qbit.Config{
		URL:  "http://localhost:8080",
		User: "admin",
		Pass: "qbitpassword",
		// Optional HTTP basic auth in front of the Web UI:
		// HTTPUser: "nginx",
		// HTTPPass: "secret",
		Client: &http.Client{Timeout: time.Minute},
	})
	if err != nil {
		log.Fatalln("[ERROR]", err)
	}

	xfers, err := q.GetXfers()
	if err != nil {
		log.Fatalln("[ERROR]", err)
	}

	for _, xfer := range xfers {
		log.Println(xfer.Name, xfer.Progress, xfer.SavePath)
	}
}

New logs in immediately. NewNoAuth skips that and logs in on the first API call (useful when you only need the client constructed at startup).

About

Go Library for interacting with Qbittorrent (not complete)

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages