mega-sdk 0.1.0__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.
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: mega-sdk
3
+ Version: 0.1.0
4
+ Summary: A lightweight Python client library for interacting with the MEGA.nz API
5
+ Author: edward011
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/theUser0011/mega-sdk
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.25.0
14
+ Requires-Dist: pycryptodome>=3.10.0
15
+
16
+ # mega-sdk
17
+
18
+ A lightweight, reliable Python client library for interacting with the **MEGA.nz** API. `mega-sdk` provides simple abstractions for logging in, uploading/downloading files, managing folders, exporting public links, and handling rate limits with built-in retries.
19
+
20
+ ---
21
+
22
+ ## Features
23
+
24
+ - **Flexible Login**: Support for full user accounts, salt v1/v2 login, and temporary anonymous user sessions.
25
+ - **File Management**: Upload, download, move, rename, delete, and empty the rubbish bin.
26
+ - **Folder Support**: Nested folder creation (`mkdir` / `create_folder`), path-based folder lookups, and target directory resolution.
27
+ - **Sharing & Links**: Generate public links for files and folders or import public file URLs directly into your cloud drive.
28
+ - **Built-in Backoff**: Automatic exponential backoff and retry handling for transient API failures (`EAGAIN` / rate limits).
29
+
30
+ ---
31
+
32
+ ## Installation
33
+
34
+ Install `mega-sdk` directly from PyPI using `pip`:
35
+
36
+ ```bash
37
+ pip install mega-sdk
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Quick Start
43
+
44
+ ### 1. User Authentication
45
+
46
+ ```python
47
+ from mega_sdk import Mega
48
+
49
+ # Initialize instance
50
+ mega = Mega()
51
+
52
+ # Login with email and password
53
+ mega.login("your_email@example.com", "your_password")
54
+
55
+ # Get user quota information (in MB)
56
+ remaining_quota = mega.get_quota()
57
+ print(f"Remaining quota: {remaining_quota:.2f} MB")
58
+ ```
59
+
60
+ ### 2. Anonymous Login
61
+
62
+ ```python
63
+ from mega_sdk import Mega
64
+
65
+ # Login as a temporary anonymous user session
66
+ mega = Mega()
67
+ mega.login() # Calling login with no arguments creates an anonymous session
68
+ ```
69
+
70
+ ---
71
+
72
+ ## File Operations
73
+
74
+ ### Uploading a File
75
+
76
+ ```python
77
+ # Basic upload to root folder
78
+ uploaded_file = mega.upload("example.pdf")
79
+
80
+ # Upload with a progress callback
81
+ def on_progress(current_bytes, total_bytes):
82
+ percent = (current_bytes / total_bytes) * 100
83
+ print(f"Progress: {percent:.1f}% ({current_bytes}/{total_bytes} bytes)")
84
+
85
+ mega.upload("large_file.zip", progress_callback=on_progress)
86
+ ```
87
+
88
+ ### Downloading a File
89
+
90
+ ```python
91
+ # Find a file in your cloud drive
92
+ file_info = mega.find("example.pdf")
93
+
94
+ # Download file to a local destination directory
95
+ if file_info:
96
+ mega.download(file_info, dest_path="./downloads")
97
+
98
+ # Download directly via a public MEGA URL
99
+ mega.download_url(
100
+ "https://mega.nz/#!file_handle!file_key",
101
+ dest_path="./downloads"
102
+ )
103
+ ```
104
+
105
+ ### Creating Folders
106
+
107
+ ```python
108
+ # Create a single directory or nested path in your Cloud Drive
109
+ created_folders = mega.create_folder("Documents/Projects/2026")
110
+ ```
111
+
112
+ ### Generating Public Links
113
+
114
+ ```python
115
+ # Get a shareable link for a file object
116
+ file_info = mega.find("example.pdf")
117
+ public_link = mega.get_link(file_info)
118
+ print("Share link:", public_link)
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Exception Handling
124
+
125
+ `mega-sdk` exports structured exceptions for API errors:
126
+
127
+ ```python
128
+ from mega_sdk import Mega, RequestError, ValidationError
129
+
130
+ mega = Mega()
131
+
132
+ try:
133
+ mega.login("user@example.com", "wrong_password")
134
+ except RequestError as err:
135
+ print(f"API Error Code {err.code}: {err.message}")
136
+ except ValidationError as err:
137
+ print(f"Validation Error: {err}")
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Requirements
143
+
144
+ - **Python**: `>= 3.8`
145
+ - **Dependencies**: `requests`, `pycryptodome`
146
+
147
+ ---
148
+
149
+ ## License
150
+
151
+ This project is licensed under the **MIT License**.
@@ -0,0 +1,136 @@
1
+ # mega-sdk
2
+
3
+ A lightweight, reliable Python client library for interacting with the **MEGA.nz** API. `mega-sdk` provides simple abstractions for logging in, uploading/downloading files, managing folders, exporting public links, and handling rate limits with built-in retries.
4
+
5
+ ---
6
+
7
+ ## Features
8
+
9
+ - **Flexible Login**: Support for full user accounts, salt v1/v2 login, and temporary anonymous user sessions.
10
+ - **File Management**: Upload, download, move, rename, delete, and empty the rubbish bin.
11
+ - **Folder Support**: Nested folder creation (`mkdir` / `create_folder`), path-based folder lookups, and target directory resolution.
12
+ - **Sharing & Links**: Generate public links for files and folders or import public file URLs directly into your cloud drive.
13
+ - **Built-in Backoff**: Automatic exponential backoff and retry handling for transient API failures (`EAGAIN` / rate limits).
14
+
15
+ ---
16
+
17
+ ## Installation
18
+
19
+ Install `mega-sdk` directly from PyPI using `pip`:
20
+
21
+ ```bash
22
+ pip install mega-sdk
23
+ ```
24
+
25
+ ---
26
+
27
+ ## Quick Start
28
+
29
+ ### 1. User Authentication
30
+
31
+ ```python
32
+ from mega_sdk import Mega
33
+
34
+ # Initialize instance
35
+ mega = Mega()
36
+
37
+ # Login with email and password
38
+ mega.login("your_email@example.com", "your_password")
39
+
40
+ # Get user quota information (in MB)
41
+ remaining_quota = mega.get_quota()
42
+ print(f"Remaining quota: {remaining_quota:.2f} MB")
43
+ ```
44
+
45
+ ### 2. Anonymous Login
46
+
47
+ ```python
48
+ from mega_sdk import Mega
49
+
50
+ # Login as a temporary anonymous user session
51
+ mega = Mega()
52
+ mega.login() # Calling login with no arguments creates an anonymous session
53
+ ```
54
+
55
+ ---
56
+
57
+ ## File Operations
58
+
59
+ ### Uploading a File
60
+
61
+ ```python
62
+ # Basic upload to root folder
63
+ uploaded_file = mega.upload("example.pdf")
64
+
65
+ # Upload with a progress callback
66
+ def on_progress(current_bytes, total_bytes):
67
+ percent = (current_bytes / total_bytes) * 100
68
+ print(f"Progress: {percent:.1f}% ({current_bytes}/{total_bytes} bytes)")
69
+
70
+ mega.upload("large_file.zip", progress_callback=on_progress)
71
+ ```
72
+
73
+ ### Downloading a File
74
+
75
+ ```python
76
+ # Find a file in your cloud drive
77
+ file_info = mega.find("example.pdf")
78
+
79
+ # Download file to a local destination directory
80
+ if file_info:
81
+ mega.download(file_info, dest_path="./downloads")
82
+
83
+ # Download directly via a public MEGA URL
84
+ mega.download_url(
85
+ "https://mega.nz/#!file_handle!file_key",
86
+ dest_path="./downloads"
87
+ )
88
+ ```
89
+
90
+ ### Creating Folders
91
+
92
+ ```python
93
+ # Create a single directory or nested path in your Cloud Drive
94
+ created_folders = mega.create_folder("Documents/Projects/2026")
95
+ ```
96
+
97
+ ### Generating Public Links
98
+
99
+ ```python
100
+ # Get a shareable link for a file object
101
+ file_info = mega.find("example.pdf")
102
+ public_link = mega.get_link(file_info)
103
+ print("Share link:", public_link)
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Exception Handling
109
+
110
+ `mega-sdk` exports structured exceptions for API errors:
111
+
112
+ ```python
113
+ from mega_sdk import Mega, RequestError, ValidationError
114
+
115
+ mega = Mega()
116
+
117
+ try:
118
+ mega.login("user@example.com", "wrong_password")
119
+ except RequestError as err:
120
+ print(f"API Error Code {err.code}: {err.message}")
121
+ except ValidationError as err:
122
+ print(f"Validation Error: {err}")
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Requirements
128
+
129
+ - **Python**: `>= 3.8`
130
+ - **Dependencies**: `requests`, `pycryptodome`
131
+
132
+ ---
133
+
134
+ ## License
135
+
136
+ This project is licensed under the **MIT License**.
@@ -0,0 +1,151 @@
1
+ Metadata-Version: 2.4
2
+ Name: mega-sdk
3
+ Version: 0.1.0
4
+ Summary: A lightweight Python client library for interacting with the MEGA.nz API
5
+ Author: edward011
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/theUser0011/mega-sdk
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.25.0
14
+ Requires-Dist: pycryptodome>=3.10.0
15
+
16
+ # mega-sdk
17
+
18
+ A lightweight, reliable Python client library for interacting with the **MEGA.nz** API. `mega-sdk` provides simple abstractions for logging in, uploading/downloading files, managing folders, exporting public links, and handling rate limits with built-in retries.
19
+
20
+ ---
21
+
22
+ ## Features
23
+
24
+ - **Flexible Login**: Support for full user accounts, salt v1/v2 login, and temporary anonymous user sessions.
25
+ - **File Management**: Upload, download, move, rename, delete, and empty the rubbish bin.
26
+ - **Folder Support**: Nested folder creation (`mkdir` / `create_folder`), path-based folder lookups, and target directory resolution.
27
+ - **Sharing & Links**: Generate public links for files and folders or import public file URLs directly into your cloud drive.
28
+ - **Built-in Backoff**: Automatic exponential backoff and retry handling for transient API failures (`EAGAIN` / rate limits).
29
+
30
+ ---
31
+
32
+ ## Installation
33
+
34
+ Install `mega-sdk` directly from PyPI using `pip`:
35
+
36
+ ```bash
37
+ pip install mega-sdk
38
+ ```
39
+
40
+ ---
41
+
42
+ ## Quick Start
43
+
44
+ ### 1. User Authentication
45
+
46
+ ```python
47
+ from mega_sdk import Mega
48
+
49
+ # Initialize instance
50
+ mega = Mega()
51
+
52
+ # Login with email and password
53
+ mega.login("your_email@example.com", "your_password")
54
+
55
+ # Get user quota information (in MB)
56
+ remaining_quota = mega.get_quota()
57
+ print(f"Remaining quota: {remaining_quota:.2f} MB")
58
+ ```
59
+
60
+ ### 2. Anonymous Login
61
+
62
+ ```python
63
+ from mega_sdk import Mega
64
+
65
+ # Login as a temporary anonymous user session
66
+ mega = Mega()
67
+ mega.login() # Calling login with no arguments creates an anonymous session
68
+ ```
69
+
70
+ ---
71
+
72
+ ## File Operations
73
+
74
+ ### Uploading a File
75
+
76
+ ```python
77
+ # Basic upload to root folder
78
+ uploaded_file = mega.upload("example.pdf")
79
+
80
+ # Upload with a progress callback
81
+ def on_progress(current_bytes, total_bytes):
82
+ percent = (current_bytes / total_bytes) * 100
83
+ print(f"Progress: {percent:.1f}% ({current_bytes}/{total_bytes} bytes)")
84
+
85
+ mega.upload("large_file.zip", progress_callback=on_progress)
86
+ ```
87
+
88
+ ### Downloading a File
89
+
90
+ ```python
91
+ # Find a file in your cloud drive
92
+ file_info = mega.find("example.pdf")
93
+
94
+ # Download file to a local destination directory
95
+ if file_info:
96
+ mega.download(file_info, dest_path="./downloads")
97
+
98
+ # Download directly via a public MEGA URL
99
+ mega.download_url(
100
+ "https://mega.nz/#!file_handle!file_key",
101
+ dest_path="./downloads"
102
+ )
103
+ ```
104
+
105
+ ### Creating Folders
106
+
107
+ ```python
108
+ # Create a single directory or nested path in your Cloud Drive
109
+ created_folders = mega.create_folder("Documents/Projects/2026")
110
+ ```
111
+
112
+ ### Generating Public Links
113
+
114
+ ```python
115
+ # Get a shareable link for a file object
116
+ file_info = mega.find("example.pdf")
117
+ public_link = mega.get_link(file_info)
118
+ print("Share link:", public_link)
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Exception Handling
124
+
125
+ `mega-sdk` exports structured exceptions for API errors:
126
+
127
+ ```python
128
+ from mega_sdk import Mega, RequestError, ValidationError
129
+
130
+ mega = Mega()
131
+
132
+ try:
133
+ mega.login("user@example.com", "wrong_password")
134
+ except RequestError as err:
135
+ print(f"API Error Code {err.code}: {err.message}")
136
+ except ValidationError as err:
137
+ print(f"Validation Error: {err}")
138
+ ```
139
+
140
+ ---
141
+
142
+ ## Requirements
143
+
144
+ - **Python**: `>= 3.8`
145
+ - **Dependencies**: `requests`, `pycryptodome`
146
+
147
+ ---
148
+
149
+ ## License
150
+
151
+ This project is licensed under the **MIT License**.
@@ -0,0 +1,7 @@
1
+ README.md
2
+ pyproject.toml
3
+ mega_sdk.egg-info/PKG-INFO
4
+ mega_sdk.egg-info/SOURCES.txt
5
+ mega_sdk.egg-info/dependency_links.txt
6
+ mega_sdk.egg-info/requires.txt
7
+ mega_sdk.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ requests>=2.25.0
2
+ pycryptodome>=3.10.0
@@ -0,0 +1,29 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mega-sdk"
7
+ version = "0.1.0"
8
+ description = "A lightweight Python client library for interacting with the MEGA.nz API"
9
+ readme = "README.md"
10
+ authors = [
11
+ { name = "edward011" }
12
+ ]
13
+ license = { text = "MIT" }
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: MIT License",
17
+ "Operating System :: OS Independent",
18
+ ]
19
+ requires-python = ">=3.8"
20
+ dependencies = [
21
+ "requests>=2.25.0",
22
+ "pycryptodome>=3.10.0"
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://github.com/theUser0011/mega-sdk"
27
+
28
+ [tool.setuptools.packages.find]
29
+ include = ["mega_sdk*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+