<jupyter_start><jupyter_text>Getting Started with the Basics  Import ArcGIS API for Python<jupyter_code>from arcgis.gis import GIS<jupyter_output><empty_output><jupyter_text>Make an anonymous connection to AGOL<jupyter_code>gis_anonymous = GIS()
gis_anonymous<jupyter_output><empty_output><jupyter_text>Connect to ArcGIS Enterprise Portal<jupyter_code>import os # Pull username/password from Environment variables
gis_portal = GIS(url="https://idt.esri.com/portal", username=os.environ["API_IDT_USER"],\
                 password=os.environ["API_IDT_PWD"], profile="idt_bill")
print(gis_portal)
print(gis_portal.users.me)<jupyter_output>GIS @ https://idt.esri.com/portal
<User username:bmajor><jupyter_text>Connect by reusing a profile<jupyter_code>gis_profile = GIS(profile="idt_bill")
print(gis_profile)
print(gis_profile.users.me)<jupyter_output>GIS @ https://idt.esri.com/portal
<User username:bmajor><jupyter_text>Connect to a PKI Protect Portal<jupyter_code>gis_pki = GIS(url="https://gleneagle.esri.com/portal", cert_file="C:\\Temp\\bmajor.pfx", password="<PASSWORD>")
print(gis_pki)
print(gis_pki.users.me)<jupyter_output>GIS @ https://gleneagle.esri.com/portal
<User username:<EMAIL>><jupyter_text>Display a map<jupyter_code>map1 = gis_anonymous.map()
map1<jupyter_output><empty_output><jupyter_text>Quickly find some content<jupyter_code>from IPython.display import display
emt = gis_anonymous.content.search("Fire", item_type="Feature Layer", max_items=3)
from IPython.display import display
for item in emt:
    display(item)<jupyter_output><empty_output><jupyter_text>Add Layer to Map<jupyter_code>#get the first item
collier_emt = emt[0]

#add to map
map1 = gis_anonymous.map('Collier County, FL')
map1.add_layer(collier_emt)
map1<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12288613303269448, 'fraction_numerical': 0.003945885005636978, 'mean_word_length': 8.491978609625669, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 5, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '185391', 'license': 'Apache-2.0', 'n_tokens_mistral': 690, 'n_tokens_neox': 685, 'n_words': 104, 'path': 'talks/DCDevSummit2018/Getting Started with the ArcGIS API for Python/Get_Started_with_GIS_Connection.ipynb', 'repo_name': 'nitz21/arcpy', 'size': '1781'}