aiobtclientapi 1.1.2__tar.gz → 1.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. aiobtclientapi-1.1.4/PKG-INFO +47 -0
  2. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/__init__.py +2 -7
  3. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/base/api.py +2 -3
  4. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/qbittorrent/api.py +1 -1
  5. aiobtclientapi-1.1.4/aiobtclientapi.egg-info/PKG-INFO +47 -0
  6. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi.egg-info/SOURCES.txt +16 -2
  7. aiobtclientapi-1.1.4/aiobtclientapi.egg-info/requires.txt +15 -0
  8. aiobtclientapi-1.1.4/aiobtclientapi.egg-info/top_level.txt +6 -0
  9. aiobtclientapi-1.1.4/docs/conf.py +20 -0
  10. aiobtclientapi-1.1.4/docs/usage_example.py +52 -0
  11. aiobtclientapi-1.1.4/pyproject.toml +59 -0
  12. aiobtclientapi-1.1.4/tests/clients_test/base_test/base_api_test.py +784 -0
  13. aiobtclientapi-1.1.4/tests/clients_test/deluge_test/deluge_api_test.py +513 -0
  14. aiobtclientapi-1.1.4/tests/clients_test/qbittorrent_test/qbittorrent_api_test.py +529 -0
  15. aiobtclientapi-1.1.4/tests/clients_test/rtorrent_test/rtorrent_api_test.py +706 -0
  16. aiobtclientapi-1.1.4/tests/clients_test/rtorrent_test/rtorrent_utils_test.py +93 -0
  17. aiobtclientapi-1.1.4/tests/clients_test/transmission_test/transmission_api_test.py +564 -0
  18. aiobtclientapi-1.1.4/tests/errors_test.py +201 -0
  19. aiobtclientapi-1.1.4/tests/init_test.py +59 -0
  20. aiobtclientapi-1.1.4/tests/response_test.py +466 -0
  21. aiobtclientapi-1.1.4/tests/utils_test/monitor_test.py +288 -0
  22. aiobtclientapi-1.1.4/tests/utils_test/torrent_test.py +120 -0
  23. aiobtclientapi-1.1.4/tests/utils_test/utils_test.py +426 -0
  24. aiobtclientapi-1.1.2/PKG-INFO +0 -32
  25. aiobtclientapi-1.1.2/aiobtclientapi.egg-info/PKG-INFO +0 -32
  26. aiobtclientapi-1.1.2/aiobtclientapi.egg-info/requires.txt +0 -4
  27. aiobtclientapi-1.1.2/aiobtclientapi.egg-info/top_level.txt +0 -1
  28. aiobtclientapi-1.1.2/setup.py +0 -43
  29. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/LICENSE +0 -0
  30. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/README.rst +0 -0
  31. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/cli.py +0 -0
  32. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/__init__.py +0 -0
  33. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/base/__init__.py +0 -0
  34. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/deluge/__init__.py +0 -0
  35. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/deluge/api.py +0 -0
  36. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/qbittorrent/__init__.py +0 -0
  37. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/rtorrent/__init__.py +0 -0
  38. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/rtorrent/api.py +0 -0
  39. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/rtorrent/utils.py +0 -0
  40. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/transmission/__init__.py +0 -0
  41. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/transmission/api.py +0 -0
  42. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/clients/transmission/enums.py +0 -0
  43. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/constants.py +0 -0
  44. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/errors.py +0 -0
  45. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/response.py +0 -0
  46. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/utils/__init__.py +0 -0
  47. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/utils/monitor.py +0 -0
  48. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi/utils/torrent.py +0 -0
  49. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi.egg-info/dependency_links.txt +0 -0
  50. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/aiobtclientapi.egg-info/entry_points.txt +0 -0
  51. {aiobtclientapi-1.1.2 → aiobtclientapi-1.1.4}/setup.cfg +0 -0
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.4
2
+ Name: aiobtclientapi
3
+ Version: 1.1.4
4
+ Summary: Asynchronous high-level communication with BitTorrent clients
5
+ Author-email: plotski <plotski@example.org>
6
+ License: GPL-3.0-or-later
7
+ Project-URL: Repository, https://codeberg.org/plotski/aiobtclientapi
8
+ Project-URL: Documentation, https://aiobtclientapi.readthedocs.io
9
+ Project-URL: Bug Tracker, https://codeberg.org/plotski/aiobtclientapi/issues
10
+ Project-URL: Changelog, https://codeberg.org/plotski/aiobtclientapi/raw/branch/master/NEWS
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/x-rst
15
+ License-File: LICENSE
16
+ Requires-Dist: aiobtclientrpc==5.*
17
+ Requires-Dist: async-timeout==4.*
18
+ Requires-Dist: httpx==0.*
19
+ Requires-Dist: torf==4.*
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest; extra == "dev"
22
+ Requires-Dist: pytest-asyncio; extra == "dev"
23
+ Requires-Dist: pytest-mock; extra == "dev"
24
+ Requires-Dist: tox; extra == "dev"
25
+ Requires-Dist: coverage; extra == "dev"
26
+ Requires-Dist: pytest-cov; extra == "dev"
27
+ Requires-Dist: ruff; extra == "dev"
28
+ Requires-Dist: flake8; extra == "dev"
29
+ Requires-Dist: isort; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ ``aiobtclientapi`` is an asynchronous API for communicating with BitTorrent
33
+ clients. It is a high-level wrapper around `aiobtclientrpc`_.
34
+
35
+ .. _aiobtclientrpc: https://codeberg.org/plotski/aiobtclientrpc
36
+
37
+ All client-specific details are abstracted away as much as possible, but the
38
+ individual quirks of each client can still be accessed if necessary.
39
+
40
+ | Documentation: https://aiobtclientapi.readthedocs.io/
41
+ | Repository: https://codeberg.org/plotski/aiobtclientapi
42
+ | Package: https://pypi.org/project/aiobtclientapi/
43
+
44
+ License
45
+ -------
46
+
47
+ `GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.en.html>`_
@@ -2,19 +2,14 @@
2
2
  Asynchronous high-level communication with BitTorrent clients
3
3
  """
4
4
 
5
- __project_name__ = 'aiobtclientapi'
6
- __description__ = 'Asynchronous high-level communication with BitTorrent clients'
7
- __homepage__ = 'https://codeberg.org/plotski/aiobtclientapi'
8
- __version__ = '1.1.2'
9
- __author__ = 'plotski'
10
- __author_email__ = 'plotski@example.org'
5
+ __version__ = '1.1.4'
11
6
 
12
7
  # isort:skip_file
13
8
 
14
9
  from .clients import APIBase
15
10
  from .clients import DelugeAPI, QbittorrentAPI, RtorrentAPI, TransmissionAPI
16
11
  from .response import Response
17
- from .errors import *
12
+ from .errors import * # noqa: F403
18
13
 
19
14
  from functools import lru_cache as _lru_cache
20
15
 
@@ -5,7 +5,6 @@ Base class for client APIs
5
5
  import abc
6
6
  import asyncio
7
7
  import collections
8
- import os
9
8
 
10
9
  import aiobtclientrpc
11
10
 
@@ -98,7 +97,7 @@ class APIBase(abc.ABC):
98
97
  except BaseException as e:
99
98
  # Exceptions from `coro` or `done_callback` end up nowhere, so
100
99
  # we print the traceback manually and beat it.
101
- import sys, traceback # isort:skip
100
+ import sys, traceback # noqa: E401, isort:skip
102
101
  tb = ''.join(traceback.format_exception(type(e), e, e.__traceback__))
103
102
  _log.debug('%s: Background task or done_callback croaked: %r', self.label, task.get_name())
104
103
  _log.debug('%s: %s', self.label, tb)
@@ -259,7 +258,7 @@ class APIBase(abc.ABC):
259
258
  return await Response.from_call(
260
259
  self._add_torrents(
261
260
  torrents=torrents,
262
- location=str(os.path.abspath(location)) if location else None,
261
+ location=str(location) if location else None,
263
262
  stopped=stopped,
264
263
  verify=verify,
265
264
  ),
@@ -73,7 +73,7 @@ class QbittorrentAPI(base.APIBase, aiobtclientrpc.QbittorrentRPC):
73
73
 
74
74
  return rpc_args, infohash
75
75
 
76
- _timeout_add_torrent = 10.0
76
+ _timeout_add_torrent = 30.0
77
77
 
78
78
  async def _add_torrent(self, torrent, *, location, stopped, verify):
79
79
  rpc_args, infohash = await self._make_add_torrent_args(
@@ -0,0 +1,47 @@
1
+ Metadata-Version: 2.4
2
+ Name: aiobtclientapi
3
+ Version: 1.1.4
4
+ Summary: Asynchronous high-level communication with BitTorrent clients
5
+ Author-email: plotski <plotski@example.org>
6
+ License: GPL-3.0-or-later
7
+ Project-URL: Repository, https://codeberg.org/plotski/aiobtclientapi
8
+ Project-URL: Documentation, https://aiobtclientapi.readthedocs.io
9
+ Project-URL: Bug Tracker, https://codeberg.org/plotski/aiobtclientapi/issues
10
+ Project-URL: Changelog, https://codeberg.org/plotski/aiobtclientapi/raw/branch/master/NEWS
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/x-rst
15
+ License-File: LICENSE
16
+ Requires-Dist: aiobtclientrpc==5.*
17
+ Requires-Dist: async-timeout==4.*
18
+ Requires-Dist: httpx==0.*
19
+ Requires-Dist: torf==4.*
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest; extra == "dev"
22
+ Requires-Dist: pytest-asyncio; extra == "dev"
23
+ Requires-Dist: pytest-mock; extra == "dev"
24
+ Requires-Dist: tox; extra == "dev"
25
+ Requires-Dist: coverage; extra == "dev"
26
+ Requires-Dist: pytest-cov; extra == "dev"
27
+ Requires-Dist: ruff; extra == "dev"
28
+ Requires-Dist: flake8; extra == "dev"
29
+ Requires-Dist: isort; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ ``aiobtclientapi`` is an asynchronous API for communicating with BitTorrent
33
+ clients. It is a high-level wrapper around `aiobtclientrpc`_.
34
+
35
+ .. _aiobtclientrpc: https://codeberg.org/plotski/aiobtclientrpc
36
+
37
+ All client-specific details are abstracted away as much as possible, but the
38
+ individual quirks of each client can still be accessed if necessary.
39
+
40
+ | Documentation: https://aiobtclientapi.readthedocs.io/
41
+ | Repository: https://codeberg.org/plotski/aiobtclientapi
42
+ | Package: https://pypi.org/project/aiobtclientapi/
43
+
44
+ License
45
+ -------
46
+
47
+ `GPLv3+ <https://www.gnu.org/licenses/gpl-3.0.en.html>`_
@@ -1,6 +1,6 @@
1
1
  LICENSE
2
2
  README.rst
3
- setup.py
3
+ pyproject.toml
4
4
  aiobtclientapi/__init__.py
5
5
  aiobtclientapi/cli.py
6
6
  aiobtclientapi/constants.py
@@ -27,4 +27,18 @@ aiobtclientapi/clients/transmission/api.py
27
27
  aiobtclientapi/clients/transmission/enums.py
28
28
  aiobtclientapi/utils/__init__.py
29
29
  aiobtclientapi/utils/monitor.py
30
- aiobtclientapi/utils/torrent.py
30
+ aiobtclientapi/utils/torrent.py
31
+ docs/conf.py
32
+ docs/usage_example.py
33
+ tests/errors_test.py
34
+ tests/init_test.py
35
+ tests/response_test.py
36
+ tests/clients_test/base_test/base_api_test.py
37
+ tests/clients_test/deluge_test/deluge_api_test.py
38
+ tests/clients_test/qbittorrent_test/qbittorrent_api_test.py
39
+ tests/clients_test/rtorrent_test/rtorrent_api_test.py
40
+ tests/clients_test/rtorrent_test/rtorrent_utils_test.py
41
+ tests/clients_test/transmission_test/transmission_api_test.py
42
+ tests/utils_test/monitor_test.py
43
+ tests/utils_test/torrent_test.py
44
+ tests/utils_test/utils_test.py
@@ -0,0 +1,15 @@
1
+ aiobtclientrpc==5.*
2
+ async-timeout==4.*
3
+ httpx==0.*
4
+ torf==4.*
5
+
6
+ [dev]
7
+ pytest
8
+ pytest-asyncio
9
+ pytest-mock
10
+ tox
11
+ coverage
12
+ pytest-cov
13
+ ruff
14
+ flake8
15
+ isort
@@ -0,0 +1,6 @@
1
+ aiobtclientapi
2
+ data
3
+ dist
4
+ docs
5
+ tests
6
+ venv
@@ -0,0 +1,20 @@
1
+ extensions = [
2
+ 'sphinx.ext.autodoc',
3
+ 'sphinx.ext.autosummary',
4
+ 'sphinx.ext.intersphinx',
5
+ 'sphinx.ext.viewcode',
6
+ ]
7
+
8
+ autosummary_generate = True
9
+ autosummary_imported_members = True
10
+
11
+ autodoc_member_order = 'bysource'
12
+
13
+ html_show_sourcelink = False # Don't show links to rST code
14
+
15
+ templates_path = ['_templates']
16
+
17
+ intersphinx_mapping = {
18
+ 'python': ('https://docs.python.org/3/', None),
19
+ 'aiobtclientrpc': ('https://aiobtclientrpc.readthedocs.io/en/stable/', None),
20
+ }
@@ -0,0 +1,52 @@
1
+ import asyncio
2
+ import aiobtclientapi
3
+
4
+ async def run():
5
+ # Create API instance
6
+ try:
7
+ api = aiobtclientapi.api(
8
+ name="qbittorrent",
9
+ url="localhost:5000",
10
+ username="AzureDiamond",
11
+ password="hunter2",
12
+ )
13
+ except aiobtclientapi.ValueError as e:
14
+ # Invalid client name or URL
15
+ print('Error:', e)
16
+ exit(1)
17
+
18
+ # Add torrents
19
+ response = await api.add(
20
+ "path/to/my.first.torrent",
21
+ "path/to/my.second.torrent",
22
+ "path/to/my.third.torrent",
23
+ stopped=True,
24
+ )
25
+
26
+ # success is only True if all of the torrents were added
27
+ if not response.success:
28
+ print("Something went wrong!")
29
+
30
+ # Handle errors
31
+ for error in response.errors:
32
+ print("Error:", error)
33
+
34
+ # Handle warnings
35
+ for warning in response.warnings:
36
+ print("Warning:", warning)
37
+
38
+ # Show which torrents were actually added
39
+ for infohash in response.added:
40
+ print("Added:", infohash)
41
+
42
+ # Get a list of existing torrents
43
+ try:
44
+ infohashes = await api.get_infohashes()
45
+ except aiobtclientapi.ConnectionError as e:
46
+ print("Unable to get infohashes:", e)
47
+ else:
48
+ print("Infohashes:")
49
+ for infohash in infohashes:
50
+ print(f" * {infohash}")
51
+
52
+ asyncio.run(run())
@@ -0,0 +1,59 @@
1
+ [project]
2
+ name = "aiobtclientapi"
3
+ description = "Asynchronous high-level communication with BitTorrent clients"
4
+ readme = "README.rst"
5
+ license = {text = "GPL-3.0-or-later"}
6
+ authors = [
7
+ { name="plotski", email="plotski@example.org" },
8
+ ]
9
+ dynamic = ["version"] # Get version from PROJECT/__version__
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
13
+ ]
14
+ requires-python = ">=3.8"
15
+ dependencies = [
16
+ "aiobtclientrpc==5.*",
17
+ "async-timeout==4.*",
18
+ "httpx==0.*",
19
+ "torf==4.*",
20
+ ]
21
+
22
+ [project.optional-dependencies]
23
+ dev = [
24
+ "pytest",
25
+ "pytest-asyncio",
26
+ "pytest-mock",
27
+
28
+ "tox",
29
+
30
+ "coverage",
31
+ "pytest-cov",
32
+
33
+ "ruff",
34
+ "flake8",
35
+ "isort",
36
+ ]
37
+
38
+ [project.scripts]
39
+ btclient = "aiobtclientapi.cli:run_sync"
40
+
41
+ [project.urls]
42
+ Repository = "https://codeberg.org/plotski/aiobtclientapi"
43
+ Documentation = "https://aiobtclientapi.readthedocs.io"
44
+ "Bug Tracker" = "https://codeberg.org/plotski/aiobtclientapi/issues"
45
+ Changelog = "https://codeberg.org/plotski/aiobtclientapi/raw/branch/master/NEWS"
46
+
47
+
48
+ [build-system]
49
+ requires = ["setuptools"]
50
+ build-backend = "setuptools.build_meta"
51
+
52
+ # For some unknown reason, we need to specify explicity to scan the project
53
+ # directory with default parameters or setuptools gets confused about
54
+ # directories like "docs" or "venv".
55
+ [tool.setuptools.packages]
56
+ find = {}
57
+
58
+ [tool.setuptools.dynamic]
59
+ version = {attr = "aiobtclientapi.__version__"}