<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python. Get full storage information in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642447#M3046</link>
    <description>&lt;P&gt;Hello. How can I display the full size of my storage using python?&lt;/P&gt;
&lt;P&gt;I was able to get only the occupied volume:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;print(dbx.users_get_space_usage().used)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only thing I could do was get this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;print(dbx.users_get_space_usage().allocation)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SpaceAllocation('individual', IndividualSpaceAllocation(allocated=2147483648))&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know how to extract "allocated" from here.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Dec 2022 08:16:00 GMT</pubDate>
    <dc:creator>vas1992</dc:creator>
    <dc:date>2022-12-08T08:16:00Z</dc:date>
    <item>
      <title>Python. Get full storage information</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642447#M3046</link>
      <description>&lt;P&gt;Hello. How can I display the full size of my storage using python?&lt;/P&gt;
&lt;P&gt;I was able to get only the occupied volume:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;print(dbx.users_get_space_usage().used)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The only thing I could do was get this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;print(dbx.users_get_space_usage().allocation)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;SpaceAllocation('individual', IndividualSpaceAllocation(allocated=2147483648))&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know how to extract "allocated" from here.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 08:16:00 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642447#M3046</guid>
      <dc:creator>vas1992</dc:creator>
      <dc:date>2022-12-08T08:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Python. Get full storage information</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642533#M3049</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1505491"&gt;@vas1992&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;I don't know how to extract "allocated" from here.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1505491"&gt;@vas1992&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You can do it like any other field on any other object in Python (as programing language). Just read what you have got in documentation. 'users_get_space_usage' method returns &lt;A title="Information about a user's space usage and quota" href="https://github.com/dropbox/dropbox-sdk-python/blob/main/dropbox/users.py#L801" target="_blank" rel="noopener"&gt;SpaceUsage&lt;/A&gt; class object. You have successful get in touch to 'used' field of this object (type &lt;STRONG&gt;int&lt;/STRONG&gt;). &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@994EEA5C10EE66675FFD5E4032FE58C0/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;&lt;/P&gt;&lt;P&gt;The other field of the same object - 'allocation' - is not basic type, but another object! The object's type is &lt;A title="To get the associated value of a tag (if one exists), use the corresponding ``get_*`` method" href="https://github.com/dropbox/dropbox-sdk-python/blob/main/dropbox/users.py#L708" target="_blank" rel="noopener"&gt;SpaceAllocation&lt;/A&gt; - an union of individual and team allocation data. Since your account is individual (in the particular case, but you should check it in a common case), 'get_individual' method is applicable. This method result is of type &lt;A href="https://github.com/dropbox/dropbox-sdk-python/blob/9895d705317583cedb9fc11e5aa1f17f6bea303a/dropbox/users.py#L548" target="_blank" rel="noopener"&gt;IndividualSpaceAllocation&lt;/A&gt; class. I believe it's easy to see that field 'allocated' can be accessed here (int type) in the same way you are accessing 'used' field before. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@41457EF40051AFF130FDBFE21B496926/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt; Take a look &lt;A title="dropbox.users.SpaceAllocation" href="https://dropbox-sdk-python.readthedocs.io/en/latest/api/users.html#dropbox.users.SpaceAllocation" target="_blank" rel="noopener"&gt;here&lt;/A&gt; too.&lt;/P&gt;&lt;P&gt;Hope this clarifies matter.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 14:24:41 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642533#M3049</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2022-12-08T14:24:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python. Get full storage information</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642593#M3053</link>
      <description>&lt;P&gt;Something I did not understand at all. It is possible as much as possible in detail, for stupid?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;print(dropbox.users.SpaceAllocation('individual', value=None).get_individual())&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting an error:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Traceback (most recent call last):&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;File "/home/vas/MyScripts/UploadCSV/RMS_up_Dx.py", line 108, in &amp;lt;module&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;space_usage(dbx)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;File "/home/vas/MyScripts/UploadCSV/RMS_up_Dx.py", line 66, in space_usage&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;print(dropbox.users.SpaceAllocation('individual', value=None).get_individual())&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;File "/home/vas/.local/lib/python3.8/site-packages/stone/backends/python_rsrc/stone_base.py", line 145, in __init__&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;validator.validate_type_only(value)&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;File "/home/vas/.local/lib/python3.8/site-packages/stone/backends/python_rsrc/stone_validators.py", line 543, in validate_type_only&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;raise ValidationError('expected type %s, got %s' %&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;stone.backends.python_rsrc.stone_validators.ValidationError: expected type dropbox.users.IndividualSpaceAllocation, got null&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 17:05:30 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642593#M3053</guid>
      <dc:creator>vas1992</dc:creator>
      <dc:date>2022-12-08T17:05:30Z</dc:date>
    </item>
    <item>
      <title>Re: Python. Get full storage information</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642596#M3054</link>
      <description>&lt;P&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1505491"&gt;@vas1992&lt;/a&gt; Здравко is correct; here's what a simple usage of this may look like:&lt;/P&gt;
&lt;PRE class="language-python"&gt;&lt;CODE&gt;allocation = dbx.users_get_space_usage().allocation
if allocation.is_individual():
    print("Individual allocation:")
    print(allocation.get_individual().allocated)
elif allocation.is_team():
    print("Team allocation:")
    print(allocation.get_team().allocated)
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 17:06:42 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642596#M3054</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-12-08T17:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Python. Get full storage information</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642602#M3057</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1505491"&gt;@vas1992&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;I am getting an error:&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Of course, when you are using invalid object, errors can be expected. Even more, would be strange if it passes without error.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 17:15:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642602#M3057</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2022-12-08T17:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Python. Get full storage information</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642610#M3058</link>
      <description>&lt;P&gt;Thank you for helping me.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Dec 2022 17:41:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/Python-Get-full-storage-information/m-p/642610#M3058</guid>
      <dc:creator>vas1992</dc:creator>
      <dc:date>2022-12-08T17:41:52Z</dc:date>
    </item>
  </channel>
</rss>

