read me update and tests

master
richard 2013-04-28 16:56:17 +01:00
parent 36bed09dde
commit d15be6deff
3 changed files with 20 additions and 13 deletions

View File

@ -43,6 +43,11 @@ balance = m.get_balance()
```python
quota = m.get_quota()
```
### Get account storage space
```python
# unit output kilo, mega, gig, otherwise bytes output
space = m.get_storage_space(kilo=True)
```
### Get account files
```python
files = m.get_files()

View File

@ -305,11 +305,11 @@ class Mega(object):
raise ValueError("Only one unit prefix can be specified")
unit_coef = 1
if kilo:
unit_coef = 1024.
unit_coef = 1024
if mega:
unit_coef = 1048576.
unit_coef = 1048576
if giga:
unit_coef = 1073741824.
unit_coef = 1073741824
json_resp = self.api_request({'a': 'uq', 'xfer': 1, 'strg': 1})
return {
'used': json_resp['cstrg'] / unit_coef,

View File

@ -27,6 +27,8 @@ def test():
# get account disk quota in MB
print(m.get_quota())
# get account storage space
print(m.get_storage_space())
# example iterate over files
for file in files: