Commit graph

289 commits

Author SHA1 Message Date
Ethan Dalool
66c0c8f179 Return exported urls as dict of {id: url}. 2020-10-01 12:09:02 -07:00
Ethan Dalool
400701f50d Dedent by raising early. 2020-10-01 11:27:31 -07:00
Ethan Dalool
5609db3482 Allow exporting multiple files at once via batch request. 2020-10-01 11:26:31 -07:00
Ethan Dalool
9492be4899 Cache the result of get_files into variable _files.
get_files is a slow method, and there are lots of calls to it
throughout the code. Not changing any methods to use this cached
value just yet, but it really helps in the REPL at least.
2020-10-01 11:23:50 -07:00
Ethan Dalool
95de60fd86 Let _api_request return batch responses from batch requests. 2020-10-01 11:21:57 -07:00
Ethan Dalool
2ad6024ad8 Slightly jank fix to deal with extra data after json dict.
Even though the dict decodes just fine, I'm having some cases where
there is additional data after it. The data looks like random junk
bytes.
2020-10-01 11:21:32 -07:00
Ethan Dalool
5a2f14b312 Merge remote-tracking branch 'upstream/master'
# Conflicts:
#	README.md
#	src/mega/crypto.py
#	src/mega/errors.py
#	src/mega/mega.py
2020-09-21 21:39:25 -07:00
Richard O'Dwyer
c27d8379e4 speed up CI 2020-06-25 21:48:06 +01:00
Richard O'Dwyer
04bae1885a Back to development: 1.0.9 2020-06-25 21:44:31 +01:00
Richard O'Dwyer
34f3e73359 Preparing release 1.0.8 2020-06-25 21:44:19 +01:00
Richard O'Dwyer
cf1a1196a8 docs 2020-06-25 21:40:12 +01:00
Richard
6daa2bdf3c
Merge pull request #8 from odwyersoftware/fixes2
Various fixes
2020-06-25 21:37:25 +01:00
Richard O'Dwyer
74939e07b4 lint 2020-06-25 21:36:43 +01:00
Richard O'Dwyer
aaac16a8cc fix issue #6 2020-06-25 21:15:36 +01:00
Richard O'Dwyer
781e3a267b various fixes 2020-06-25 21:03:16 +01:00
Richard O'Dwyer
aa89af0324 Updates URL parsing, updates API error code handling 2020-06-21 16:18:22 +01:00
Richard O'Dwyer
631ca606ff link to the website 2020-04-28 17:15:12 +01:00
Richard O'Dwyer
ecf42c1b35 Preparing release 1.0.7 2020-03-25 20:09:37 +00:00
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
Richard O'Dwyer
fa6d1149d4 linting 2020-03-23 19:00:06 +00:00
richardARPANET
6f3f5371ce Merge branch 'fixlogin' into 'master'
Fix RSA Invalid Condition on login

Closes #10

See merge request richardARPANET/mega.py!2
2020-03-23 18:55:03 +00:00
Ethan Dalool
059f819c9c Use """ instead of ''' for docstrings. 2020-03-23 11:43:51 -07:00