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
Richard O'Dwyer
fa6d1149d4
linting
2020-03-23 19:00:06 +00:00
Ethan Dalool
059f819c9c
Use """ instead of ''' for docstrings.
2020-03-23 11:43:51 -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
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
4d343f1b25
Increase the wait time in between failed API request retries.
2019-11-18 20:58:37 +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
92a86ff439
Fixes download, updated download methods to return downloded path instead of None
2019-11-12 09:49:57 +00:00
Richard O'Dwyer
13cb3b565e
testing
2019-11-06 20:00:09 +00:00
Richard O'Dwyer
b87694e72d
When a request fails due to EAGAIN response, retry with exp backoff up to 20 seconds.
2019-11-05 21:21:53 +00:00
Richard O'Dwyer
e9985e7831
adds logging
2019-11-04 23:42:44 +00:00
Richard O'Dwyer
5261751dc3
adds exclude_deleted flag to find()
2019-10-31 22:17:48 +00:00
Richard O'Dwyer
5ec9e78c42
speed up find method
2019-10-31 21:38:04 +00:00
Richard O'Dwyer
5bef10b4cb
Create folder and export, support sub folders
2019-10-23 23:04:03 +01:00
Richard O'Dwyer
a7aa99bfe5
Adds code, message attrs to RequestError exception, makes message in raised exceptions include more details.
2019-10-23 19:52:52 +01:00
Richard O'Dwyer
deaa5468ec
rm deprecation notice, its alive again
2019-10-22 23:20:53 +01:00
Richard O'Dwyer
93f3e6d376
Adds export method, fixes login for v2 accounts, rm get_contacts() method
2019-10-22 22:39:42 +01:00
Richard O'Dwyer
4e5f88ef5f
Python 3 bugfix to `upload
` method.
2019-10-17 21:02:52 +01:00
Richard O'Dwyer
2656c7fc02
rm unwanted files in git
2019-10-16 22:45:26 +01:00
Richard O'Dwyer
e8a92bef43
lint
2019-10-16 22:40:13 +01:00
Richard O'Dwyer
e088987c1d
lint
2019-10-16 22:26:05 +01:00
Richard O'Dwyer
a15095ab9d
modernize packaging
2019-10-16 22:16:46 +01:00