Dan
Dan

Reputation: 5

Python Dropbox API v2 - users_get_space_usage() does not equal value from dropbox application

import dropbox (9.4.0)

dbx = dropbox.Dropbox("xxx")

print(dbx.users_get_space_usage().used)

outputs 606873703 or 592.65 MB but the dropbox client shows 578.76 MB. This is from the webpage and the windows 10 client.

Am is using the wrong function?

Upvotes: 0

Views: 119

Answers (1)

Greg
Greg

Reputation: 16930

It looks like this is due to using different factors when converting between bytes and "MB" . For reference, see the different definitions of Megabyte vs. Mebibyte.

  • 606873703 / 1000 / 1000 = 606.87 "Megabytes"
  • 606873703 / 1000 / 1024 = 592.65 "Megabytes" (with "less common" 1024000 factor) [your conversion]
  • 606873703 / 1024 / 1024 = 578.76 "Mebibytes" [Dropbox's conversion]

If you want to match Dropbox's formatting, use the "Mebibyte" convention instead.

Upvotes: 1

Related Questions