<jupyter_start><jupyter_text>5 Minute Tutorial   Using the ArcGIS API for Python to Accessing Content ArcGIS Online and Enterprise provide a wealth of publicly and privately shared information.  The ArcGIS API for Python can easily find and use content of the various types.  Setup the Environment We will begin by putting are imports at the top of the notebook<jupyter_code>from arcgis.gis import GIS<jupyter_output><empty_output><jupyter_text>Connect to the `GIS` Content can be explored as an anonymous user and/or as an authenticated user.- Anonymous users can only access public data- Authenticated data can access organizational data, your private data, or shared data to your username<jupyter_code>gis = GIS()<jupyter_output><empty_output><jupyter_text>The Content Manager   What is the Content Manager? The `ContentManager` class allows for the following:- Search for content- Add, update and delete content- Share/Unshare Content- Create/Delete folders- Replace vector tile services  Using the Content Manager - It is a property off of the GIS class- The content manager follows a common pattern:    + `get` method - retrieves an item by ID    + `search` method - finds item by keywords    + `add` method - uploads new content to the site<jupyter_code>gis.content<jupyter_output><empty_output><jupyter_text>Searching - returns a list of `Item` classes<jupyter_code>gis.content.search(query="concert",
                   item_type="Feature Layer",
                   sort_field='avgRating',
                   sort_order='asc',
                   max_items=20)<jupyter_output><empty_output><jupyter_text>Retrieving a Single Item - if you know what you want, use the Item Id to Get it.<jupyter_code>gis.content.get('5ae9e138a17842688b0b79283a4353f6')<jupyter_output><empty_output><jupyter_text>Using Advanced Search - Sometimes the basic search does not suite the needs.  `advanced_search` allows for complete control over the searching experience. **How Many Items?**<jupyter_code>gis.content.advanced_search(query="Census, Europe",
                            return_count=True)<jupyter_output><empty_output><jupyter_text>**Raw Responses**<jupyter_code>raw = gis.content.advanced_search(query="Census, Europe", max_items=-1)
len(raw['results'])<jupyter_output><empty_output><jupyter_text>**Type of Item Counts**<jupyter_code>stats = gis.content.advanced_search(query="Census, Europe", 
                                    count_fields='tags, contentstatus, type')
%matplotlib inline
import matplotlib.pyplot as plt
import pandas as pd
for c in stats['counts']:
    if c['fieldName'] == 'type':
        break
c
ax = (
    pd.DataFrame(c['fieldValues'])
     .reset_index()
     .plot(kind='barh', 
           #stacked=True, 
           y='count', 
           x='value', 
           #label='value',
           colormap='Accent')
);<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.0899581589958159, 'fraction_numerical': 0.009762900976290097, 'mean_word_length': 4.095914742451154, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '643319', 'license': 'Apache-2.0', 'n_tokens_mistral': 873, 'n_tokens_neox': 828, 'n_words': 263, 'path': 'basic/03. Accessing Content on Enterprise_AGOL.ipynb', 'repo_name': 'achapkowski/5_minute_Tutorials', 'size': '2868'}