10
3
Fork
You've already forked sciop-cli
4

Qbittorrent client adapter #25

Merged
sneakers-the-rat merged 10 commits from qbt-client into main 2025年06月26日 07:10:25 +02:00

ok here we go: want to be able to interact with the qbittorrent client and store logins, so made a tiny little wrapper around qbittorrent-api. just added a few convenience functions for now and only added a method to add a torrent to the client, but we can expand this as needed.

I also changed the way that secrets were handled, moving them into a type so that we could have multiple things that stored in the keychain without needing to babysit them, but that required a little bit of an awkward closure becuase the type is created at class instantiation time rather than field instantiation time. we can fix it later if it's broken, but it should work for now lol.

made a general skeleton so we could make adapters to multiple clients - we aren't trying to make a full-on API adapter here, just wrap what we need to for the sake of using the cli with sciop.

made it so that you can have multiple clients configured and then address them by index

so basically this should work like

$ sciop-cli client login 
Which type of client? (qbittorrent): qbittorrent
Username: admin
Password: 
Host: localhost
Port: 8080
Added new client configuration
{'client': 'qbittorrent', 'host': 'localhost', 'port': 8080, 'username': 'admin', 'password': SecretStr('**********')}

and then you can see your available configs by index

$ sciop-cli client list 
{
 0: QBittorrentConfig(client='qbittorrent', host='localhost', port=8080, username='admin', password=SecretStr('**********')),
 1: QBittorrentConfig(client='qbittorrent', host='example.com/qbt', port=8080, username='admin', password=SecretStr('**********'))
}

and then all the api methods take that index as an argument.


also: for the sake of search - fixed refreshing tokens, it was just all wrong before

ok here we go: want to be able to interact with the qbittorrent client and store logins, so made a tiny little wrapper around `qbittorrent-api`. just added a few convenience functions for now and only added a method to add a torrent to the client, but we can expand this as needed. I also changed the way that secrets were handled, moving them into a type so that we could have multiple things that stored in the keychain without needing to babysit them, but that required a little bit of an awkward closure becuase the type is created at class instantiation time rather than field instantiation time. we can fix it later if it's broken, but it should work for now lol. made a general skeleton so we could make adapters to multiple clients - we aren't trying to make a full-on API adapter here, just wrap what we need to for the sake of using the cli with sciop. made it so that you can have multiple clients configured and then address them by index so basically this should work like ```shell $ sciop-cli client login Which type of client? (qbittorrent): qbittorrent Username: admin Password: Host: localhost Port: 8080 Added new client configuration {'client': 'qbittorrent', 'host': 'localhost', 'port': 8080, 'username': 'admin', 'password': SecretStr('**********')} ``` and then you can see your available configs by index ```shell $ sciop-cli client list { 0: QBittorrentConfig(client='qbittorrent', host='localhost', port=8080, username='admin', password=SecretStr('**********')), 1: QBittorrentConfig(client='qbittorrent', host='example.com/qbt', port=8080, username='admin', password=SecretStr('**********')) } ``` and then all the api methods take that index as an argument. --- also: for the sake of search - fixed refreshing tokens, it was just all wrong before
add qbittorrent client adapter, update secret handling to handle multiple keys in same field
Some checks failed
lint / black (pull_request) Successful in 38s
lint / ruff (pull_request) Successful in 38s
lint / mypy (pull_request) Failing after 1m0s
tests / tests (pull_request) Successful in 2m7s
3e67585e84
rm print
Some checks failed
lint / black (pull_request) Successful in 38s
lint / ruff (pull_request) Successful in 38s
lint / mypy (pull_request) Failing after 1m1s
tests / tests (pull_request) Successful in 2m13s
cd7a69e967
mypy
All checks were successful
lint / ruff (pull_request) Successful in 45s
lint / black (pull_request) Successful in 1m0s
lint / mypy (pull_request) Successful in 1m4s
tests / tests (pull_request) Successful in 2m8s
3617961345
python 311 compat
All checks were successful
lint / ruff (pull_request) Successful in 57s
lint / black (pull_request) Successful in 1m12s
lint / mypy (pull_request) Successful in 1m5s
tests / tests (pull_request) Successful in 2m14s
f037ae76bf
test for no keyring
All checks were successful
lint / ruff (pull_request) Successful in 46s
lint / black (pull_request) Successful in 1m1s
lint / mypy (pull_request) Successful in 1m3s
tests / tests (pull_request) Successful in 2m16s
b78b836442
fix auto refreshing tokens
Some checks failed
lint / ruff (pull_request) Successful in 45s
lint / black (pull_request) Successful in 1m2s
lint / mypy (pull_request) Failing after 1m4s
tests / tests (pull_request) Successful in 2m0s
a8a071f11b
rm junk file
Some checks failed
lint / black (pull_request) Successful in 40s
lint / ruff (pull_request) Successful in 38s
lint / mypy (pull_request) Failing after 1m2s
tests / tests (pull_request) Successful in 2m20s
e4b4c22650
mypy again
All checks were successful
lint / black (pull_request) Successful in 40s
lint / ruff (pull_request) Successful in 39s
lint / mypy (pull_request) Successful in 1m3s
tests / tests (pull_request) Successful in 2m15s
a7580af0f3
check for getting too many tokens
All checks were successful
lint / black (pull_request) Successful in 38s
lint / ruff (pull_request) Successful in 38s
lint / mypy (pull_request) Successful in 1m3s
tests / tests (pull_request) Successful in 2m8s
7d7857aa15
Sign in to join this conversation.
No reviewers
Labels
Clear labels
api
Compat/Breaking
Breaking change that won't be backward compatible
Kind/Bug
Something is not working
Kind/Documentation
Documentation changes
Kind/Enhancement
Improve existing functionality
Kind/Feature
New functionality
Kind/Security
This is security issue
Kind/Tech Debt
Kind/Testing
Issue or pull request related to testing
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Safeguarding/sciop-cli!25
Reference in a new issue
Safeguarding/sciop-cli
No description provided.
Delete branch "qbt-client"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?