async-mega-py 2.4.0__tar.gz → 2.4.1__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 (24) hide show
  1. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/PKG-INFO +2 -2
  2. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/pyproject.toml +3 -3
  3. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/core.py +14 -5
  4. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/LICENSE +0 -0
  5. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/README.md +0 -0
  6. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/__init__.py +0 -0
  7. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/__main__.py +0 -0
  8. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/api.py +0 -0
  9. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/auth.py +0 -0
  10. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/chunker.py +0 -0
  11. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/client.py +0 -0
  12. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/crypto.py +0 -0
  13. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/data_structures.py +0 -0
  14. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/download.py +0 -0
  15. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/env.py +0 -0
  16. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/errors.py +0 -0
  17. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/filesystem.py +0 -0
  18. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/progress/__init__.py +0 -0
  19. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/progress/rich_progress.py +0 -0
  20. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/py.typed +0 -0
  21. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/transfer_it.py +0 -0
  22. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/upload.py +0 -0
  23. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/utils.py +0 -0
  24. {async_mega_py-2.4.0 → async_mega_py-2.4.1}/src/mega/vault.py +0 -0
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: async-mega.py
3
- Version: 2.4.0
3
+ Version: 2.4.1
4
4
  Summary: Python library for the Mega.nz and Transfer.it API
5
5
  Keywords: api,downloader,mega,mega.nz,transfer.it
6
6
  Author: NTFSvolume
7
7
  Author-email: NTFSvolume <NTFSvolume@proton.me>
8
8
  License-Expression: Apache-2.0
9
9
  License-File: LICENSE
10
- Classifier: Development Status :: 4 - Beta
10
+ Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Environment :: Console
12
12
  Classifier: Framework :: AsyncIO
13
13
  Classifier: Intended Audience :: Developers
@@ -2,7 +2,7 @@
2
2
  name = "async-mega.py"
3
3
  authors = [{name = "NTFSvolume", email = "NTFSvolume@proton.me"}]
4
4
  classifiers = [
5
- "Development Status :: 4 - Beta",
5
+ "Development Status :: 5 - Production/Stable",
6
6
  "Environment :: Console",
7
7
  "Framework :: AsyncIO",
8
8
  "Intended Audience :: Developers",
@@ -34,7 +34,7 @@ license = "Apache-2.0"
34
34
  license-files = ["LICENSE"]
35
35
  readme = "README.md"
36
36
  requires-python = ">=3.11"
37
- version = "2.4.0"
37
+ version = "2.4.1"
38
38
 
39
39
  [project.optional-dependencies]
40
40
  cli = [
@@ -123,7 +123,7 @@ requires = ["uv_build<=0.10.11"]
123
123
 
124
124
  [dependency-groups]
125
125
  dev = [
126
- "prek>=0.3.6",
126
+ "prek>=0.4.0",
127
127
  "pytest-asyncio>=0.25.0",
128
128
  "pytest>=8.3.5",
129
129
  "ruff==0.15.6"
@@ -106,18 +106,27 @@ class MegaCore:
106
106
  return result.public_handle, result.public_key, result.selected_node
107
107
 
108
108
  @staticmethod
109
- def parse_url(url: str | yarl.URL) -> PublicURLInfo:
110
- """Parse a public URL"""
109
+ def ensure_v2_url(url: str | yarl.URL) -> yarl.URL:
110
+ """Transform an URL in V1 format to v2"""
111
111
  url = yarl.URL(url)
112
112
  Site.MEGA.check_host(url)
113
113
  new_url = transform_v1_url(url)
114
114
  if new_url != url:
115
115
  logger.info(f"Transformed v1 URL from {url} to {new_url}")
116
+ return new_url
116
117
 
117
- url = new_url
118
- if not url.fragment:
118
+ @staticmethod
119
+ def parse_url(url: str | yarl.URL, *, check_key: bool = True) -> PublicURLInfo:
120
+ """Parse a public URL"""
121
+ url = MegaCore.ensure_v2_url(url)
122
+ info = MegaCore._parse_public_v2_url(url)
123
+ if check_key and not info.public_key:
119
124
  raise ValidationError(f"Public key missing from {url}")
125
+ return info
120
126
 
127
+ @staticmethod
128
+ def _parse_public_v2_url(url: yarl.URL, /) -> PublicURLInfo:
129
+ """Parse a public URL"""
121
130
  match url.parts[1:]:
122
131
  case ["file", public_handle]:
123
132
  return PublicURLInfo(False, public_handle, url.fragment)
@@ -422,7 +431,7 @@ class MegaCore:
422
431
  ) -> Node:
423
432
  """Import the public file into user account"""
424
433
  full_key = b64_to_a32(public_key)
425
- key = Crypto.decompose(full_key).key
434
+ key = Crypto.decompose(full_key).key # pyright: ignore[reportArgumentType]
426
435
  file_info = await self.request_file_info(public_handle, is_public=True)
427
436
  name = self.decrypt_attrs(file_info._at, key, public_handle).name
428
437
  encrypted_key = a32_to_base64(encrypt_key(full_key, self.vault.master_key))
File without changes
File without changes