I know you can get a users storage quota and usage but how do you find out the individual feature class storage of an item using portal py or another method?
The PortalPy module is still around but it is being superseded by the ArcGIS Python API. I don't believe what you ask is doable directly or only through PortalPy, but you can do it using the new ArcGIS Python API:
<SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="keyword token">import</SPAN> arcgis <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> url <SPAN class="operator token">=</SPAN> <SPAN class="comment token"># url of Portal or Organizational AGOL</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> username <SPAN class="operator token">=</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> password <SPAN class="operator token">=</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> item_name <SPAN class="operator token">=</SPAN> <SPAN class="comment token"># name of item for looking up size</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> gis <SPAN class="operator token">=</SPAN> arcgis<SPAN class="punctuation token">.</SPAN>gis<SPAN class="punctuation token">.</SPAN>GIS<SPAN class="punctuation token">(</SPAN>url<SPAN class="punctuation token">,</SPAN> username<SPAN class="punctuation token">,</SPAN> password<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> item <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>content<SPAN class="punctuation token">.</SPAN>search<SPAN class="punctuation token">(</SPAN>item_name<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="comment token"># assumes unique name so only 1 item returned</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> item_full <SPAN class="operator token">=</SPAN> gis<SPAN class="punctuation token">.</SPAN>content<SPAN class="punctuation token">.</SPAN>get<SPAN class="punctuation token">(</SPAN>item<SPAN class="punctuation token">.</SPAN>id<SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN> item_full<SPAN class="punctuation token">.</SPAN>size <SPAN class="number token">3850776</SPAN> <SPAN class="operator token">>></SPAN><SPAN class="operator token">></SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
Personally, I got a bit of heartburn over how items are returned when using search in the new API, but that is a soapbox for another venue and another day.
If you don't or can't utilize the ArcGIS Python API, the guts of the code from the Example: Copy content can be used to write a script for accessing an item's size.
thanks a lot for this!
From ArcGIS Python API Install and setup:
Install the latest version of Anaconda for Python (for Python 3.5), if you don't already have conda. The ArcGIS Python API requires Python 3.If you have installed ArcGIS Pro 1.3, you already have conda and you can use that instead of downloading Anaconda.
Install the latest version of Anaconda for Python (for Python 3.5), if you don't already have conda. The ArcGIS Python API requires Python 3.
If you have installed ArcGIS Pro 1.3, you already have conda and you can use that instead of downloading Anaconda.
Do you have ArcGIS Pro installed? There is at least one other Python interpreter on your machine, a Python 3 interpreter, because it wouldn't be working at all otherwise. Try running the script from the Python installation that Jupyter notebook it using, not a Python 2.7 installation.
thanks that helps. I've installed ArcGIS Python and got this running through the Jupyter notebook. Works well. Got your code above working through this too.
Only issue I've hit is trying to get the same code running from a standalone python script. I get the following error.
gis = arcgis.gis.GIS(url, username, password)AttributeError: 'module' object has no attribute 'gis'
Running this under Python 2.7. works fine in a notebook. Any ideas?
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.