Repository navigation
Refresh qbit: deps, CI, lint, tests, and request bugs #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c599699
Refresh qbit for current Go, CI, and lint, and cover the small API wi…
davidnewhall 2febe30
Accept qBittorrent 5.2 empty 204 login and API responses.
davidnewhall da2fa0b
Only re-login once on 401/403, and disable wsl_v5.
davidnewhall 950f8d9
Stream JSON for successful API responses instead of buffering the who…
davidnewhall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,6 @@ | ||
| { | ||
| "$schema": "https://docs.renovatebot.com/renovate-schema.json", | ||
| "extends": [ | ||
| "config:base", | ||
| "default:automergeDigest" | ||
| ], | ||
| "packageRules": [ | ||
| { | ||
| "matchDatasources": ["go", "github-releases", "github-tags"], | ||
| "matchUpdateTypes": ["minor", "patch", "pin", "digest"], | ||
| "automerge": true | ||
| } | ||
| "config:recommended" | ||
| ] | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,52 @@ | ||
| version: '2' | ||
| linters: | ||
| enable-all: true | ||
| default: all | ||
| disable: | ||
| # deprecated | ||
| - maligned | ||
| - scopelint | ||
| - interfacer | ||
| - golint | ||
| - exhaustivestruct | ||
| - nosnakecase | ||
| - structcheck | ||
| - deadcode | ||
| - varcheck | ||
| - ifshort | ||
| # unused | ||
| - dupl | ||
| - exhaustruct | ||
| - exhaustruct_v5 | ||
| - musttag | ||
| - nlreturn | ||
| - tagliatelle | ||
| run: | ||
| timeout: 3m | ||
| - noinlineerr | ||
| - wsl | ||
| - wsl_v5 | ||
| - funcorder | ||
| - gomodguard | ||
| settings: | ||
| depguard: | ||
| rules: | ||
| main: | ||
| files: | ||
| - $all | ||
| allow: | ||
| - $gostd | ||
| - github.com/stretchr/testify | ||
| - golift.io/qbit | ||
| - golang.org/x/net | ||
| exclusions: | ||
| generated: lax | ||
| presets: | ||
| - std-error-handling | ||
| rules: | ||
| - linters: | ||
| - err113 | ||
| - forcetypeassert | ||
| - funlen | ||
| - gochecknoglobals | ||
| - lll | ||
| - goconst | ||
| path: (.+)_test\.go | ||
| paths: | ||
| - test | ||
| - queue | ||
|
|
||
| issues: | ||
| max-issues-per-linter: 0 | ||
| max-same-issues: 0 | ||
| formatters: | ||
| enable: | ||
| - gci | ||
| - gofmt | ||
| - gofumpt | ||
| - goimports | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,64 @@ | ||
| # Go Library: qbit | ||
| # qbit | ||
|
|
||
| Go Library used to interact with Qbittorrent. This library is not full-featured, | ||
| and probably only provides read-only methods to view the download list. | ||
| [](https://pkg.go.dev/golift.io/qbit) | ||
| [](https://goreportcard.com/report/golift.io/qbit) | ||
| [](https://github.com/golift/qbit/blob/main/LICENSE) | ||
|
|
||
| At the time of this writing (creation), the library only supports logging in, | ||
| and collecting transfer info. | ||
| Go library to interact with the [qBittorrent](https://github.com/qbittorrent/qBittorrent) Web API. | ||
|
|
||
| If you'd like new features, please open a GitHub issue or pull request. | ||
| 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](https://github.com/golift/qbit/issues/new) or a pull request. | ||
|
|
||
| Example: | ||
| This library is used by [Notifiarr](https://github.com/Notifiarr/notifiarr/). | ||
|
|
||
| qBittorrent 5.2+ returns HTTP 204 on login and other empty WebAPI responses. | ||
| Older 200/`Ok.` logins still work. | ||
|
|
||
| ## Install | ||
|
|
||
| ```shell | ||
| go get golift.io/qbit | ||
| ``` | ||
|
|
||
| ## Example | ||
|
|
||
| ```go | ||
| package main | ||
|
|
||
| import ( | ||
| "context" | ||
| "log" | ||
| "net/http" | ||
| "time" | ||
|
|
||
| "golift.io/qbit" | ||
| ) | ||
|
|
||
| func main() { | ||
| config := &qbit.Config{ | ||
| URL: "http://localhost:8080", | ||
| User: "admin", | ||
| Pass: "qbitpassword", | ||
| } | ||
|
|
||
| qbit, err := qbit.New(config) | ||
| 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 := qbit.GetXfers() | ||
| xfers, err := q.GetXfers() | ||
| if err != nil { | ||
| log.Fatalln("[ERROR]", err) | ||
| } | ||
|
|
||
| for _, xfer := range xfers { | ||
| log.Println(xfer.Name, xfer.Progress) | ||
| 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). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,11 @@ | ||
| module golift.io/qbit | ||
|
|
||
| go 1.17 | ||
| go 1.25.0 | ||
|
|
||
| require golang.org/x/net v0.27.0 | ||
| require golang.org/x/net v0.58.0 // publicsuffix, cookiejar. | ||
|
|
||
| // All of this is for the tests. | ||
| require ( | ||
| github.com/stretchr/testify v1.12.1 // assert! | ||
| go.yaml.in/yaml/v3 v3.0.5 // indirect | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,27 +1,6 @@ | ||
| golang.org/x/net v0.0.0-20210716203947-853a461950ff h1:j2EK/QoxYNBsXI4R7fQkkRUk8y6wnOBI+6hgPdP/6Ds= | ||
| golang.org/x/net v0.0.0-20210716203947-853a461950ff/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= | ||
| golang.org/x/net v0.4.0 h1:Q5QPcMlvfxFTAPV0+07Xz/MpK9NTXu2VDUuy0FeMfaU= | ||
| golang.org/x/net v0.4.0/go.mod h1:MBQ8lrhLObU/6UmLb4fmbmk5OcyYmqtbGd/9yIeKjEE= | ||
| golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw= | ||
| golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= | ||
| golang.org/x/net v0.6.0 h1:L4ZwwTvKW9gr0ZMS1yrHD9GZhIuVjOBBnaKH+SPQK0Q= | ||
| golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= | ||
| golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= | ||
| golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= | ||
| golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= | ||
| golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= | ||
| golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= | ||
| golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= | ||
| golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= | ||
| golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= | ||
| golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= | ||
| golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= | ||
| golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= | ||
| golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= | ||
| golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= | ||
| golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= | ||
| golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
| golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= | ||
| golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= | ||
| golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= | ||
| golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= | ||
| github.com/stretchr/testify v1.12.1 h1:EuwCh5fleGS7H32xRwO3wRGT7DxrDhLAT6FF8MpWDWE= | ||
| github.com/stretchr/testify v1.12.1/go.mod h1:MDEgiDPPsNp5cuIrHPPCyornHKgEVbtFUmoNlxoYthg= | ||
| go.yaml.in/yaml/v3 v3.0.5 h1:N6y/pJk8buWs9NY5ERU2HSMfm+IuD/OtfdAnq6kESPw= | ||
| go.yaml.in/yaml/v3 v3.0.5/go.mod h1:HVTZu1O7/Vkt2N+BFy8Zza+lnLsABggaTM2ZpNIGuKg= | ||
| golang.org/x/net v0.58.0 h1:ynWG7rqYi4ccpTEuPZ2QGWHktVEM9DMCj9yzDE0Q7To= | ||
| golang.org/x/net v0.58.0/go.mod h1:YwCddHnFlT7eLQqVprV19OnhLGtc5xOKgE0RyqgfWAU= |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.