Ethan Dalool
d29751221c
Fix missing self. on shared_keys.
2020-03-23 21:21:17 -07:00
Ethan Dalool
09f993405a
Alphabetize remaining imports.
2020-03-23 21:20:35 -07:00
Ethan Dalool
1626bc85d8
Remove import-froms for tenacity.
2020-03-23 21:20:15 -07:00
Ethan Dalool
132342e4f6
Remove import-froms for pathlib.
2020-03-23 21:17:22 -07:00
Ethan Dalool
015e5a2773
Remove import-froms for crypto.
2020-03-23 21:08:49 -07:00
Ethan Dalool
6d59de416e
Remove import-froms for errors.
2020-03-23 21:04:39 -07:00
Ethan Dalool
86e6756b2c
Remove some double blank lines.
2020-03-23 21:04:39 -07:00
Ethan Dalool
a394f9829f
Add function crypto.interleave_xor_8.
2020-03-23 21:04:34 -07:00
Ethan Dalool
ae3bcbc9e4
Add method import_public_folder.
2020-03-23 20:47:17 -07:00
Ethan Dalool
85d4f9d6a3
De-golf some crypto functions.
...
encrypt_key and decrypt_key were using a feature of sum() where
the second argument is a 'start' value and every futher value
is += onto that. Since it was a tuple, the final result is a tuple.
Replaced it with a tuple comprehension.
get_chunks just needed some variable names but I am not sure the
purpose of the increasing chunk size during iteration. It's probably
a feature of the MEGA webclient.
2020-03-23 20:47:16 -07:00
Ethan Dalool
1a7c3ea781
Add method get_public_folder_info.
2020-03-23 20:47:16 -07:00
Ethan Dalool
25c567a5a3
Add method get_public_folder_files.
...
Unfortunately I didn't figure out how to decrypt their 'a' yet.
2020-03-23 20:47:16 -07:00
Ethan Dalool
995dafceea
Make shared_keys an instance attr, it seems that way already.
...
I noticed that _init_shared_keys assigns the result to the instance,
so let's just keep it on the instance from the beginning and not
pass it around. If some individual keys get overwritten during runtime
I expect that would be ok.
2020-03-23 20:47:16 -07:00
Ethan Dalool
bb8a5081c5
Add method _api_account_version_and_salt.
2020-03-23 20:47:16 -07:00
Ethan Dalool
ac442ced7f
Add method _api_start_session.
2020-03-23 20:47:16 -07:00
Ethan Dalool
406531924c
Only call self.get_files if no path provided.
...
Note that self.find(path) still calls get_files internally so it's
going to happen either way -- this just removes a redundant call.
2020-03-23 20:47:16 -07:00
Ethan Dalool
4143b7c9db
Check for more target types but also raise TypeError if n/a.
2020-03-23 20:47:16 -07:00
Ethan Dalool
d7980400cb
Use bool(x) instead of 1 if x else 0.
2020-03-23 20:47:16 -07:00
Ethan Dalool
580b82c353
Don't put node_id into a list just to use [0].
2020-03-23 20:47:12 -07:00
Ethan Dalool
cafca108e9
Some comment and docstring changes.
2020-03-23 20:46:41 -07:00
Ethan Dalool
412cd21189
Rewrite function _parse_url to return tuple.
...
Every usage of this function was calling split on the output anyway.
2020-03-23 20:46:41 -07:00
Ethan Dalool
e7a8aeda01
De-nest multi-line dicts from function calls.
2020-03-23 20:46:40 -07:00
Ethan Dalool
7384ed9caa
Add NODE_TYPE_ constants instead of using magic numbers.
2020-03-23 20:46:35 -07:00
Ethan Dalool
5c2aa09db4
Let tenacity.retry look for our EAGAIN instead of plain error.
2020-03-23 20:43:21 -07:00
Ethan Dalool
13595f724a
Add argument params to _api_request for custom parameters.
2020-03-23 19:26:24 -07:00
Ethan Dalool
634a977a99
More core _api_request to top of method list.
2020-03-23 19:24:44 -07:00
Ethan Dalool
62871e3240
Add separate classes for API exceptions, raise error_for_code().
...
This makes the caller's life easier. They can catch
mega.errors.EFAILED instead of catching mega.errors.RequestError
and checking the message attribute.
Because these classes inherit from RequestError, and they have a code
and message attribute, anyone currently catching RequestError should
not have any backwards compatibility issues.
Furthermore, this fixes an existing issue in the codebase where
RequestError is raised with a custom string message, which was causing
IndexError since that message wasn't in CODE_TO_DESCRIPTIONS.
2020-03-23 18:54:29 -07:00
Ethan Dalool
97164fc52c
Rewrite readme as markdown.
2020-03-23 12:35:52 -07:00
Ethan Dalool
d61e81d5d2
Indicate fork status on readme.
2020-03-23 12:29:41 -07:00
Ethan Dalool
7c53d5e42d
Update HISTORY.rst.
2020-03-09 17:06:27 -07:00
Ethan Dalool
1e96d9b435
Fix v1 login by calculating public exp instead of hardcode 257.
...
The code was using a hardcoded 257 as the RSA public exponent, but
it was raising RSA Invalid Construct. From reading MEGA's webclient js
I found that the public exponent sometimes defaults to 257, but in
other cases is calculated from a modular inverse on the private
exponent and phi=p-1*q-1.
2020-03-09 15:13:12 -07:00
Ethan Dalool
f1047898e8
Deconstruct & comment this private_key MPI parser.
2020-03-09 15:08:24 -07:00
Ethan Dalool
2ba447ebad
Remove self. from self.rsa_private_key, not used elsewhere.
...
This variable is not used anywhere outside this function,
so it does not need to be an instance attribute.
2020-03-09 15:04:27 -07:00
Ethan Dalool
ebca1d4826
Add extended_gcd and modular_inverse functions.
2020-03-09 14:49:12 -07:00
Richard O'Dwyer
e28bee9439
Back to development: 1.0.7
2020-02-03 19:48:10 +00:00
Richard O'Dwyer
fc461b465a
Preparing release 1.0.6
2020-02-03 19:46:43 +00:00
Richard O'Dwyer
46cf1c46c6
updates history and ranges reqs
2020-02-03 19:46:25 +00:00
richardARPANET
c9601c5e01
Merge branch 'master' into 'master'
...
Swap pycrypto to pycryptodome
See merge request richardARPANET/mega.py!1
2020-02-03 19:44:27 +00:00
Midnight
f053a2db1b
Swap pycrypto to pycryptodome
...
Updated the reqs to use pycryptodome, fixed the RSA public exponent issue that was causing the logn failure, as well as general updates to patch up slight changes.
2020-01-24 13:08:04 -05:00
Richard O'Dwyer
dc360ebeec
Back to development: 1.0.6
2019-11-18 20:59:20 +00:00
Richard O'Dwyer
2727295a2d
Preparing release 1.0.5
2019-11-18 20:58:49 +00:00
Richard O'Dwyer
4d343f1b25
Increase the wait time in between failed API request retries.
2019-11-18 20:58:37 +00:00
Richard O'Dwyer
8888282aff
Merge branch 'master' of github.com:richardARPANET/mega.py
2019-11-18 19:05:40 +00:00
Richard O'Dwyer
fa38263dbd
Back to development: 1.0.5
2019-11-18 19:04:42 +00:00
Richard O'Dwyer
2ad38621fc
Preparing release 1.0.4
2019-11-18 19:04:18 +00:00
Richard O'Dwyer
11a1d21438
Merge branch 'master' of code.richard.do:richardARPANET/mega.py
2019-11-18 19:02:05 +00:00
Richard O'Dwyer
c3b99e222c
Increase the wait time in between failed API request retries.
2019-11-18 19:00:37 +00:00
Richard O'Dwyer
6afa4f2132
Back to development: 1.0.4
2019-11-12 09:53:16 +00:00
Richard O'Dwyer
f0ed01f32d
Preparing release 1.0.3
2019-11-12 09:52:59 +00:00
Richard
d0b0e6fae9
Merge pull request #4 from richardARPANET/bugfixes
...
Bugfixes
2019-11-12 09:50:51 +00:00