├── .gitignore ├── ArcGIS Desktop Installer ├── Install_ArcRest │ ├── Tools │ │ └── Scripts │ │ │ ├── install_arcrest.py │ │ │ └── install_arcrest.tbx │ └── commondata │ │ └── userdata │ │ ├── arcrest.zip │ │ └── arcresthelper.zip └── installing_arcrest.gpk ├── ISSUE_TEMPLATE ├── LICENSE ├── README.md ├── docs ├── Makefile ├── _build │ ├── doctrees │ │ ├── arcrest.agol.doctree │ │ ├── arcrest.agol.helperservices.doctree │ │ ├── arcrest.ags.doctree │ │ ├── arcrest.cmp.doctree │ │ ├── arcrest.common.doctree │ │ ├── arcrest.doctree │ │ ├── arcrest.enrichment.doctree │ │ ├── arcrest.geometryservice.doctree │ │ ├── arcrest.hostedservice.doctree │ │ ├── arcrest.manageags.doctree │ │ ├── arcrest.manageorg.doctree │ │ ├── arcrest.manageportal.doctree │ │ ├── arcrest.opendata.doctree │ │ ├── arcrest.packages.doctree │ │ ├── arcrest.packages.ntlm3.doctree │ │ ├── arcrest.security.doctree │ │ ├── arcrest.web.doctree │ │ ├── arcrest.webmap.doctree │ │ ├── arcresthelper.doctree │ │ ├── arcresthelper.packages.doctree │ │ ├── environment.pickle │ │ ├── index.doctree │ │ ├── setup.doctree │ │ └── setup_wheel.doctree │ └── html │ │ ├── .buildinfo │ │ ├── _modules │ │ ├── arcrest │ │ │ ├── agol │ │ │ │ ├── helperservices │ │ │ │ │ ├── analysis.html │ │ │ │ │ ├── elevation.html │ │ │ │ │ ├── geocoder.html │ │ │ │ │ └── hydrology.html │ │ │ │ └── services.html │ │ │ ├── ags │ │ │ │ ├── featureservice.html │ │ │ │ ├── layer.html │ │ │ │ ├── mapservice.html │ │ │ │ ├── server.html │ │ │ │ └── services.html │ │ │ ├── cmp │ │ │ │ └── community.html │ │ │ ├── common │ │ │ │ ├── domain.html │ │ │ │ ├── errorhandlers.html │ │ │ │ ├── filters.html │ │ │ │ ├── find.html │ │ │ │ ├── general.html │ │ │ │ ├── geometry.html │ │ │ │ ├── renderer.html │ │ │ │ ├── servicedef.html │ │ │ │ ├── spatial.html │ │ │ │ └── symbology.html │ │ │ ├── geometryservice │ │ │ │ └── geometryservice.html │ │ │ ├── hostedservice │ │ │ │ └── service.html │ │ │ ├── manageags │ │ │ │ ├── administration.html │ │ │ │ └── parameters.html │ │ │ ├── manageorg │ │ │ │ └── administration.html │ │ │ ├── manageportal │ │ │ │ └── administration.html │ │ │ ├── opendata │ │ │ │ └── opendata.html │ │ │ ├── packages │ │ │ │ ├── ntlm3 │ │ │ │ │ ├── HTTPNtlmAuthHandler.html │ │ │ │ │ ├── U32.html │ │ │ │ │ ├── des.html │ │ │ │ │ ├── des_c.html │ │ │ │ │ └── ntlm.html │ │ │ │ └── six.html │ │ │ └── security │ │ │ │ └── security.html │ │ ├── arcresthelper │ │ │ ├── common.html │ │ │ ├── featureservicetools.html │ │ │ ├── orgtools.html │ │ │ ├── packages │ │ │ │ └── six.html │ │ │ ├── portalautomation.html │ │ │ ├── publishingtools.html │ │ │ ├── resettools.html │ │ │ └── securityhandlerhelper.html │ │ └── index.html │ │ ├── _sources │ │ ├── arcrest.agol.helperservices.txt │ │ ├── arcrest.agol.txt │ │ ├── arcrest.ags.txt │ │ ├── arcrest.cmp.txt │ │ ├── arcrest.common.txt │ │ ├── arcrest.enrichment.txt │ │ ├── arcrest.geometryservice.txt │ │ ├── arcrest.hostedservice.txt │ │ ├── arcrest.manageags.txt │ │ ├── arcrest.manageorg.txt │ │ ├── arcrest.manageportal.txt │ │ ├── arcrest.opendata.txt │ │ ├── arcrest.packages.ntlm3.txt │ │ ├── arcrest.packages.txt │ │ ├── arcrest.security.txt │ │ ├── arcrest.txt │ │ ├── arcrest.web.txt │ │ ├── arcrest.webmap.txt │ │ ├── arcresthelper.packages.txt │ │ ├── arcresthelper.txt │ │ ├── index.txt │ │ ├── setup.txt │ │ └── setup_wheel.txt │ │ ├── _static │ │ ├── ajax-loader.gif │ │ ├── alabaster.css │ │ ├── basic.css │ │ ├── comment-bright.png │ │ ├── comment-close.png │ │ ├── comment.png │ │ ├── doctools.js │ │ ├── down-pressed.png │ │ ├── down.png │ │ ├── file.png │ │ ├── jquery-1.11.1.js │ │ ├── jquery.js │ │ ├── minus.png │ │ ├── plus.png │ │ ├── pygments.css │ │ ├── searchtools.js │ │ ├── underscore-1.3.1.js │ │ ├── underscore.js │ │ ├── up-pressed.png │ │ ├── up.png │ │ └── websupport.js │ │ ├── arcrest.agol.helperservices.html │ │ ├── arcrest.agol.html │ │ ├── arcrest.ags.html │ │ ├── arcrest.cmp.html │ │ ├── arcrest.common.html │ │ ├── arcrest.enrichment.html │ │ ├── arcrest.geometryservice.html │ │ ├── arcrest.hostedservice.html │ │ ├── arcrest.html │ │ ├── arcrest.manageags.html │ │ ├── arcrest.manageorg.html │ │ ├── arcrest.manageportal.html │ │ ├── arcrest.opendata.html │ │ ├── arcrest.packages.html │ │ ├── arcrest.packages.ntlm3.html │ │ ├── arcrest.security.html │ │ ├── arcrest.web.html │ │ ├── arcrest.webmap.html │ │ ├── arcresthelper.html │ │ ├── arcresthelper.packages.html │ │ ├── genindex.html │ │ ├── index.html │ │ ├── objects.inv │ │ ├── py-modindex.html │ │ ├── search.html │ │ ├── searchindex.js │ │ ├── setup.html │ │ └── setup_wheel.html ├── arcrest.agol.helperservices.rst ├── arcrest.agol.rst ├── arcrest.ags.rst ├── arcrest.cmp.rst ├── arcrest.common.rst ├── arcrest.enrichment.rst ├── arcrest.geometryservice.rst ├── arcrest.hostedservice.rst ├── arcrest.manageags.rst ├── arcrest.manageorg.rst ├── arcrest.manageportal.rst ├── arcrest.opendata.rst ├── arcrest.packages.ntlm3.rst ├── arcrest.packages.rst ├── arcrest.rst ├── arcrest.security.rst ├── arcrest.web.rst ├── arcrest.webmap.rst ├── arcresthelper.packages.rst ├── arcresthelper.rst ├── conf.py ├── index.rst ├── make.bat ├── setup.rst └── setup_wheel.rst ├── notebooks ├── ArcREST Basics - Logining into the Site.ipynb ├── Demo 1 - List Current Users Content.ipynb ├── Demo 2 - List all content in a site.ipynb ├── Demo 3 - Turning ArcGIS Server Service Extensions.ipynb ├── Demo 4 - Creating and Sharing a Web Map from a Geocoding Result.ipynb ├── Demo 5 - Erasing Content on Portal.ipynb └── Demo 6 - Disable a Portal or AGOL User Account.ipynb ├── samples ├── AGOLMapServices │ └── tileserviceproperties.py ├── AGS │ ├── agsserverObjectExample.py │ ├── exportCache.py │ ├── serverDetails.py │ └── serverSecurityConfig.py ├── Change Map Service Scheme.py ├── HostedFeatureServiceAdmin │ ├── addDomainToHostedFeatureService.py │ ├── addFieldToHostedFeatureService.py │ └── listLayersInHostedFeatureService.py ├── Workforce │ ├── create_replica_all_assignments.py │ ├── dataToLoad.csv │ ├── dataToLookup.csv │ ├── load_assignments_csv.py │ ├── load_assignments_lookup.py │ ├── query_completed_work.py │ ├── query_delete_completed_work.py │ └── update_status_assignment.py ├── addItem_kml_sample.py ├── add_field_layer.py ├── add_file_geodatabase.py ├── add_item.py ├── add_list_layers_to_service.py ├── add_user_group.py ├── add_users.py ├── additem_webmap_sample.py ├── adds_rows_to_ags_service.py ├── adds_rows_to_service.py ├── append_fc_to_service.py ├── assign_credits_users.py ├── change_folder.py ├── copy_feature_service_deforgorg.py ├── copy_item.py ├── create_groups_from_csv.py ├── create_groups_support_material.zip ├── create_replica_fs.py ├── create_replica_fs_attachments_unzip_rename.py ├── create_replica_portal_item.py ├── delete_rows_from_service.py ├── disable_sync_service.py ├── disable_sync_service_item.py ├── enableEsriAccess.py ├── generate_portal_server_token.py ├── loop_users_items.py ├── publish_sd_to_service.py ├── publishingGeoJSON.py ├── query_agol_layer.py ├── query_agol_layer_using_ArcMap_Creds.py ├── query_agol_service.py ├── query_rows_from_service.py ├── query_save_features_incremental.py ├── readme.txt ├── remove_adds_rows_to_service.py ├── remove_all_content_groups_allusers.py ├── report_content_in_groups.py ├── toggleEditing.py ├── update_features.py ├── update_item.py ├── update_largethumbnail.py ├── update_rows_to_service_from_dict.py ├── update_thumbnail_csv.py ├── update_user_password.py └── walk_directory and_add_files_of_filetype.py ├── src ├── README.rst ├── arcrest │ ├── __init__.py │ ├── _abstract │ │ ├── __init__.py │ │ └── abstract.py │ ├── agol │ │ ├── __init__.py │ │ ├── _uploads.py │ │ ├── helperservices │ │ │ ├── __init__.py │ │ │ ├── analysis.py │ │ │ ├── elevation.py │ │ │ ├── geocoder.py │ │ │ └── hydrology.py │ │ └── services.py │ ├── ags │ │ ├── __init__.py │ │ ├── _geocodeservice.py │ │ ├── _geodataservice.py │ │ ├── _geoprocessing.py │ │ ├── _globeservice.py │ │ ├── _gpobjects.py │ │ ├── _imageservice.py │ │ ├── _mobileservice.py │ │ ├── _networkservice.py │ │ ├── _schematicsservice.py │ │ ├── _streamservice.py │ │ ├── _uploads.py │ │ ├── _vectortile.py │ │ ├── featureservice.py │ │ ├── layer.py │ │ ├── mapservice.py │ │ ├── server.py │ │ └── services.py │ ├── cmp │ │ ├── __init__.py │ │ └── community.py │ ├── common │ │ ├── __init__.py │ │ ├── domain.py │ │ ├── errorhandlers.py │ │ ├── filters.py │ │ ├── find.py │ │ ├── general.py │ │ ├── geometry.py │ │ ├── renderer.py │ │ ├── servicedef.py │ │ ├── spatial.py │ │ └── symbology.py │ ├── constants.py │ ├── enrichment │ │ ├── __countrycodes.csv │ │ ├── __datacollectionnames.csv │ │ ├── __init__.py │ │ └── _geoenrichment.py │ ├── geometryservice │ │ ├── __init__.py │ │ └── geometryservice.py │ ├── hostedservice │ │ ├── __init__.py │ │ └── service.py │ ├── manageags │ │ ├── __init__.py │ │ ├── _clusters.py │ │ ├── _data.py │ │ ├── _info.py │ │ ├── _kml.py │ │ ├── _logs.py │ │ ├── _machines.py │ │ ├── _mode.py │ │ ├── _security.py │ │ ├── _services.py │ │ ├── _system.py │ │ ├── _uploads.py │ │ ├── _usagereports.py │ │ ├── administration.py │ │ └── parameters.py │ ├── manageorg │ │ ├── __init__.py │ │ ├── _community.py │ │ ├── _content.py │ │ ├── _content_constants.py │ │ ├── _marketplace.py │ │ ├── _oauth2.py │ │ ├── _parameters.py │ │ ├── _portals.py │ │ └── administration.py │ ├── manageportal │ │ ├── __init__.py │ │ └── administration.py │ ├── opendata │ │ ├── __init__.py │ │ ├── _base.py │ │ ├── _web.py │ │ └── opendata.py │ ├── packages │ │ ├── __init__.py │ │ ├── ntlm3 │ │ │ ├── HTTPNtlmAuthHandler.py │ │ │ ├── U32.py │ │ │ ├── __init__.py │ │ │ ├── compat.py │ │ │ ├── des.py │ │ │ ├── des_c.py │ │ │ ├── des_data.py │ │ │ └── ntlm.py │ │ └── six.py │ ├── security │ │ ├── __init__.py │ │ └── security.py │ ├── web │ │ ├── __init__.py │ │ └── _base.py │ └── webmap │ │ ├── __init__.py │ │ ├── domain.py │ │ ├── operationallayers.py │ │ ├── renderer.py │ │ └── symbols.py ├── arcresthelper │ ├── __init__.py │ ├── common.py │ ├── featureservicetools.py │ ├── orgtools.py │ ├── packages │ │ ├── __init__.py │ │ └── six.py │ ├── portalautomation.py │ ├── publishingtools.py │ ├── resettools.py │ └── securityhandlerhelper.py ├── requirements.txt ├── setup.cfg ├── setup.py └── setup_wheel.py ├── tests ├── enrichment_tests.py ├── readme.txt └── security_tests.py ├── tools ├── ArcRESTToolbox.tbx ├── helpDocs │ └── readme.txt └── src │ ├── addItem.py │ ├── addUser.py │ ├── addUserToGroup.py │ ├── append_fc_to_fs.py │ ├── append_groupLayer_fs.py │ ├── createGroup.py │ ├── deleteGroup.py │ ├── deleteItem.py │ ├── deleteUser.py │ ├── deleteUserContent.py │ ├── delete_rows_from_fs.py │ └── post_layer_to_workforce_assignments.py └── unittests └── empty.txt /ArcGIS Desktop Installer/Install_ArcRest/Tools/Scripts/install_arcrest.tbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/ArcGIS Desktop Installer/Install_ArcRest/Tools/Scripts/install_arcrest.tbx -------------------------------------------------------------------------------- /ArcGIS Desktop Installer/Install_ArcRest/commondata/userdata/arcrest.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/ArcGIS Desktop Installer/Install_ArcRest/commondata/userdata/arcrest.zip -------------------------------------------------------------------------------- /ArcGIS Desktop Installer/Install_ArcRest/commondata/userdata/arcresthelper.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/ArcGIS Desktop Installer/Install_ArcRest/commondata/userdata/arcresthelper.zip -------------------------------------------------------------------------------- /ArcGIS Desktop Installer/installing_arcrest.gpk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/ArcGIS Desktop Installer/installing_arcrest.gpk -------------------------------------------------------------------------------- /ISSUE_TEMPLATE: -------------------------------------------------------------------------------- 1 | ### ArcRest or ArcRestHelper 2 | 3 | ### Version or date of download 4 | 5 | ### Bug or Enhancement 6 | 7 | ### Repo Steps or Enhancement details 8 | -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.agol.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.agol.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.agol.helperservices.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.agol.helperservices.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.ags.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.ags.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.cmp.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.cmp.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.common.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.common.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.enrichment.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.enrichment.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.geometryservice.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.geometryservice.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.hostedservice.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.hostedservice.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.manageags.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.manageags.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.manageorg.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.manageorg.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.manageportal.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.manageportal.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.opendata.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.opendata.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.packages.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.packages.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.packages.ntlm3.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.packages.ntlm3.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.security.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.security.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.web.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.web.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcrest.webmap.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcrest.webmap.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcresthelper.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcresthelper.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/arcresthelper.packages.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/arcresthelper.packages.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/environment.pickle -------------------------------------------------------------------------------- /docs/_build/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/index.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/setup.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/setup.doctree -------------------------------------------------------------------------------- /docs/_build/doctrees/setup_wheel.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/doctrees/setup_wheel.doctree -------------------------------------------------------------------------------- /docs/_build/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: d5f80781e7718b2e061e6501b622ada9 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.agol.helperservices.txt: -------------------------------------------------------------------------------- 1 | arcrest.agol.helperservices package 2 | =================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.agol.helperservices.analysis module 8 | ------------------------------------------- 9 | 10 | .. automodule:: arcrest.agol.helperservices.analysis 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.agol.helperservices.elevation module 16 | -------------------------------------------- 17 | 18 | .. automodule:: arcrest.agol.helperservices.elevation 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | arcrest.agol.helperservices.geocoder module 24 | ------------------------------------------- 25 | 26 | .. automodule:: arcrest.agol.helperservices.geocoder 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | arcrest.agol.helperservices.hydrology module 32 | -------------------------------------------- 33 | 34 | .. automodule:: arcrest.agol.helperservices.hydrology 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: arcrest.agol.helperservices 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.agol.txt: -------------------------------------------------------------------------------- 1 | arcrest.agol package 2 | ==================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | arcrest.agol.helperservices 10 | 11 | Submodules 12 | ---------- 13 | 14 | arcrest.agol.services module 15 | ---------------------------- 16 | 17 | .. automodule:: arcrest.agol.services 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | 23 | Module contents 24 | --------------- 25 | 26 | .. automodule:: arcrest.agol 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.ags.txt: -------------------------------------------------------------------------------- 1 | arcrest.ags package 2 | =================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.ags.featureservice module 8 | --------------------------------- 9 | 10 | .. automodule:: arcrest.ags.featureservice 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.ags.layer module 16 | ------------------------ 17 | 18 | .. automodule:: arcrest.ags.layer 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | arcrest.ags.mapservice module 24 | ----------------------------- 25 | 26 | .. automodule:: arcrest.ags.mapservice 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | arcrest.ags.server module 32 | ------------------------- 33 | 34 | .. automodule:: arcrest.ags.server 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | arcrest.ags.services module 40 | --------------------------- 41 | 42 | .. automodule:: arcrest.ags.services 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | 48 | Module contents 49 | --------------- 50 | 51 | .. automodule:: arcrest.ags 52 | :members: 53 | :undoc-members: 54 | :show-inheritance: 55 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.cmp.txt: -------------------------------------------------------------------------------- 1 | arcrest.cmp package 2 | =================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.cmp.community module 8 | ---------------------------- 9 | 10 | .. automodule:: arcrest.cmp.community 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.cmp 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.common.txt: -------------------------------------------------------------------------------- 1 | arcrest.common package 2 | ====================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.common.domain module 8 | ---------------------------- 9 | 10 | .. automodule:: arcrest.common.domain 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.common.errorhandlers module 16 | ----------------------------------- 17 | 18 | .. automodule:: arcrest.common.errorhandlers 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | arcrest.common.filters module 24 | ----------------------------- 25 | 26 | .. automodule:: arcrest.common.filters 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | arcrest.common.find module 32 | -------------------------- 33 | 34 | .. automodule:: arcrest.common.find 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | arcrest.common.general module 40 | ----------------------------- 41 | 42 | .. automodule:: arcrest.common.general 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | arcrest.common.geometry module 48 | ------------------------------ 49 | 50 | .. automodule:: arcrest.common.geometry 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | arcrest.common.renderer module 56 | ------------------------------ 57 | 58 | .. automodule:: arcrest.common.renderer 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | arcrest.common.servicedef module 64 | -------------------------------- 65 | 66 | .. automodule:: arcrest.common.servicedef 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | arcrest.common.spatial module 72 | ----------------------------- 73 | 74 | .. automodule:: arcrest.common.spatial 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | arcrest.common.symbology module 80 | ------------------------------- 81 | 82 | .. automodule:: arcrest.common.symbology 83 | :members: 84 | :undoc-members: 85 | :show-inheritance: 86 | 87 | 88 | Module contents 89 | --------------- 90 | 91 | .. automodule:: arcrest.common 92 | :members: 93 | :undoc-members: 94 | :show-inheritance: 95 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.enrichment.txt: -------------------------------------------------------------------------------- 1 | arcrest.enrichment package 2 | ========================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: arcrest.enrichment 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.geometryservice.txt: -------------------------------------------------------------------------------- 1 | arcrest.geometryservice package 2 | =============================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.geometryservice.geometryservice module 8 | ---------------------------------------------- 9 | 10 | .. automodule:: arcrest.geometryservice.geometryservice 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.geometryservice 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.hostedservice.txt: -------------------------------------------------------------------------------- 1 | arcrest.hostedservice package 2 | ============================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.hostedservice.service module 8 | ------------------------------------ 9 | 10 | .. automodule:: arcrest.hostedservice.service 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.hostedservice 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.manageags.txt: -------------------------------------------------------------------------------- 1 | arcrest.manageags package 2 | ========================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.manageags.administration module 8 | --------------------------------------- 9 | 10 | .. automodule:: arcrest.manageags.administration 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.manageags.parameters module 16 | ----------------------------------- 17 | 18 | .. automodule:: arcrest.manageags.parameters 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | 24 | Module contents 25 | --------------- 26 | 27 | .. automodule:: arcrest.manageags 28 | :members: 29 | :undoc-members: 30 | :show-inheritance: 31 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.manageorg.txt: -------------------------------------------------------------------------------- 1 | arcrest.manageorg package 2 | ========================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.manageorg.administration module 8 | --------------------------------------- 9 | 10 | .. automodule:: arcrest.manageorg.administration 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.manageorg 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.manageportal.txt: -------------------------------------------------------------------------------- 1 | arcrest.manageportal package 2 | ============================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.manageportal.administration module 8 | ------------------------------------------ 9 | 10 | .. automodule:: arcrest.manageportal.administration 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.manageportal 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.opendata.txt: -------------------------------------------------------------------------------- 1 | arcrest.opendata package 2 | ======================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.opendata.opendata module 8 | -------------------------------- 9 | 10 | .. automodule:: arcrest.opendata.opendata 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.opendata 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.packages.ntlm3.txt: -------------------------------------------------------------------------------- 1 | arcrest.packages.ntlm3 package 2 | ============================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.packages.ntlm3.HTTPNtlmAuthHandler module 8 | ------------------------------------------------- 9 | 10 | .. automodule:: arcrest.packages.ntlm3.HTTPNtlmAuthHandler 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.packages.ntlm3.U32 module 16 | --------------------------------- 17 | 18 | .. automodule:: arcrest.packages.ntlm3.U32 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | arcrest.packages.ntlm3.compat module 24 | ------------------------------------ 25 | 26 | .. automodule:: arcrest.packages.ntlm3.compat 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | arcrest.packages.ntlm3.des module 32 | --------------------------------- 33 | 34 | .. automodule:: arcrest.packages.ntlm3.des 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | arcrest.packages.ntlm3.des_c module 40 | ----------------------------------- 41 | 42 | .. automodule:: arcrest.packages.ntlm3.des_c 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | arcrest.packages.ntlm3.des_data module 48 | -------------------------------------- 49 | 50 | .. automodule:: arcrest.packages.ntlm3.des_data 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | arcrest.packages.ntlm3.ntlm module 56 | ---------------------------------- 57 | 58 | .. automodule:: arcrest.packages.ntlm3.ntlm 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | 64 | Module contents 65 | --------------- 66 | 67 | .. automodule:: arcrest.packages.ntlm3 68 | :members: 69 | :undoc-members: 70 | :show-inheritance: 71 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.packages.txt: -------------------------------------------------------------------------------- 1 | arcrest.packages package 2 | ======================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | arcrest.packages.ntlm3 10 | 11 | Submodules 12 | ---------- 13 | 14 | arcrest.packages.six module 15 | --------------------------- 16 | 17 | .. automodule:: arcrest.packages.six 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | 23 | Module contents 24 | --------------- 25 | 26 | .. automodule:: arcrest.packages 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.security.txt: -------------------------------------------------------------------------------- 1 | arcrest.security package 2 | ======================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.security.security module 8 | -------------------------------- 9 | 10 | .. automodule:: arcrest.security.security 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.security 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.txt: -------------------------------------------------------------------------------- 1 | arcrest package 2 | =============== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | arcrest.agol 10 | arcrest.ags 11 | arcrest.cmp 12 | arcrest.common 13 | arcrest.enrichment 14 | arcrest.geometryservice 15 | arcrest.hostedservice 16 | arcrest.manageags 17 | arcrest.manageorg 18 | arcrest.manageportal 19 | arcrest.opendata 20 | arcrest.packages 21 | arcrest.security 22 | arcrest.web 23 | arcrest.webmap 24 | 25 | Module contents 26 | --------------- 27 | 28 | .. automodule:: arcrest 29 | :members: 30 | :undoc-members: 31 | :show-inheritance: 32 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.web.txt: -------------------------------------------------------------------------------- 1 | arcrest.web package 2 | =================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: arcrest.web 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcrest.webmap.txt: -------------------------------------------------------------------------------- 1 | arcrest.webmap package 2 | ====================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.webmap.domain module 8 | ---------------------------- 9 | 10 | .. automodule:: arcrest.webmap.domain 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.webmap.operationallayers module 16 | --------------------------------------- 17 | 18 | .. automodule:: arcrest.webmap.operationallayers 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | arcrest.webmap.renderer module 24 | ------------------------------ 25 | 26 | .. automodule:: arcrest.webmap.renderer 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | arcrest.webmap.symbols module 32 | ----------------------------- 33 | 34 | .. automodule:: arcrest.webmap.symbols 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: arcrest.webmap 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcresthelper.packages.txt: -------------------------------------------------------------------------------- 1 | arcresthelper.packages package 2 | ============================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcresthelper.packages.six module 8 | --------------------------------- 9 | 10 | .. automodule:: arcresthelper.packages.six 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcresthelper.packages 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/arcresthelper.txt: -------------------------------------------------------------------------------- 1 | arcresthelper package 2 | ===================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | arcresthelper.packages 10 | 11 | Submodules 12 | ---------- 13 | 14 | arcresthelper.common module 15 | --------------------------- 16 | 17 | .. automodule:: arcresthelper.common 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | arcresthelper.featureservicetools module 23 | ---------------------------------------- 24 | 25 | .. automodule:: arcresthelper.featureservicetools 26 | :members: 27 | :undoc-members: 28 | :show-inheritance: 29 | 30 | arcresthelper.orgtools module 31 | ----------------------------- 32 | 33 | .. automodule:: arcresthelper.orgtools 34 | :members: 35 | :undoc-members: 36 | :show-inheritance: 37 | 38 | arcresthelper.portalautomation module 39 | ------------------------------------- 40 | 41 | .. automodule:: arcresthelper.portalautomation 42 | :members: 43 | :undoc-members: 44 | :show-inheritance: 45 | 46 | arcresthelper.publishingtools module 47 | ------------------------------------ 48 | 49 | .. automodule:: arcresthelper.publishingtools 50 | :members: 51 | :undoc-members: 52 | :show-inheritance: 53 | 54 | arcresthelper.resettools module 55 | ------------------------------- 56 | 57 | .. automodule:: arcresthelper.resettools 58 | :members: 59 | :undoc-members: 60 | :show-inheritance: 61 | 62 | arcresthelper.securityhandlerhelper module 63 | ------------------------------------------ 64 | 65 | .. automodule:: arcresthelper.securityhandlerhelper 66 | :members: 67 | :undoc-members: 68 | :show-inheritance: 69 | 70 | 71 | Module contents 72 | --------------- 73 | 74 | .. automodule:: arcresthelper 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/index.txt: -------------------------------------------------------------------------------- 1 | .. src documentation master file, created by 2 | sphinx-quickstart on Wed Feb 17 07:05:59 2016. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to src's documentation! 7 | =============================== 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 4 13 | 14 | arcrest 15 | arcresthelper 16 | setup 17 | setup_wheel 18 | 19 | 20 | Indices and tables 21 | ================== 22 | 23 | * :ref:`genindex` 24 | * :ref:`modindex` 25 | * :ref:`search` 26 | 27 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/setup.txt: -------------------------------------------------------------------------------- 1 | setup module 2 | ============ 3 | 4 | .. automodule:: setup 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/_build/html/_sources/setup_wheel.txt: -------------------------------------------------------------------------------- 1 | setup_wheel module 2 | ================== 3 | 4 | .. automodule:: setup_wheel 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/_build/html/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/ajax-loader.gif -------------------------------------------------------------------------------- /docs/_build/html/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/comment-bright.png -------------------------------------------------------------------------------- /docs/_build/html/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/comment-close.png -------------------------------------------------------------------------------- /docs/_build/html/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/comment.png -------------------------------------------------------------------------------- /docs/_build/html/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/down-pressed.png -------------------------------------------------------------------------------- /docs/_build/html/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/down.png -------------------------------------------------------------------------------- /docs/_build/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/file.png -------------------------------------------------------------------------------- /docs/_build/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/minus.png -------------------------------------------------------------------------------- /docs/_build/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/plus.png -------------------------------------------------------------------------------- /docs/_build/html/_static/up-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/up-pressed.png -------------------------------------------------------------------------------- /docs/_build/html/_static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/_static/up.png -------------------------------------------------------------------------------- /docs/_build/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/docs/_build/html/objects.inv -------------------------------------------------------------------------------- /docs/_build/html/search.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Search — src documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 |
43 |
44 |
45 |
46 | 47 |

Search

48 |
49 | 50 |

51 | Please activate JavaScript to enable the search 52 | functionality. 53 |

54 |
55 |

56 | From here you can search these documents. Enter your search 57 | words into the box below and click "search". Note that the search 58 | function will automatically search for all of the words. Pages 59 | containing fewer words won't appear in the result list. 60 |

61 |
62 | 63 | 64 | 65 |
66 | 67 |
68 | 69 |
70 | 71 |
72 |
73 |
74 | 84 |
85 |
86 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /docs/_build/html/setup.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | setup module — src documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |
37 |
38 |
39 |
40 | 41 |
42 |

setup module

43 |
44 | 45 | 46 |
47 |
48 |
49 | 81 |
82 |
83 | 94 | 95 | 96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /docs/_build/html/setup_wheel.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | setup_wheel module — src documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 |
37 |
38 |
39 | 40 |
41 |

setup_wheel module

42 |
43 | 44 | 45 |
46 |
47 |
48 | 79 |
80 |
81 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /docs/arcrest.agol.helperservices.rst: -------------------------------------------------------------------------------- 1 | arcrest.agol.helperservices package 2 | =================================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.agol.helperservices.analysis module 8 | ------------------------------------------- 9 | 10 | .. automodule:: arcrest.agol.helperservices.analysis 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.agol.helperservices.elevation module 16 | -------------------------------------------- 17 | 18 | .. automodule:: arcrest.agol.helperservices.elevation 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | arcrest.agol.helperservices.geocoder module 24 | ------------------------------------------- 25 | 26 | .. automodule:: arcrest.agol.helperservices.geocoder 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | arcrest.agol.helperservices.hydrology module 32 | -------------------------------------------- 33 | 34 | .. automodule:: arcrest.agol.helperservices.hydrology 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: arcrest.agol.helperservices 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /docs/arcrest.agol.rst: -------------------------------------------------------------------------------- 1 | arcrest.agol package 2 | ==================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | arcrest.agol.helperservices 10 | 11 | Submodules 12 | ---------- 13 | 14 | arcrest.agol.services module 15 | ---------------------------- 16 | 17 | .. automodule:: arcrest.agol.services 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | 23 | Module contents 24 | --------------- 25 | 26 | .. automodule:: arcrest.agol 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | -------------------------------------------------------------------------------- /docs/arcrest.ags.rst: -------------------------------------------------------------------------------- 1 | arcrest.ags package 2 | =================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.ags.featureservice module 8 | --------------------------------- 9 | 10 | .. automodule:: arcrest.ags.featureservice 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.ags.layer module 16 | ------------------------ 17 | 18 | .. automodule:: arcrest.ags.layer 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | arcrest.ags.mapservice module 24 | ----------------------------- 25 | 26 | .. automodule:: arcrest.ags.mapservice 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | arcrest.ags.server module 32 | ------------------------- 33 | 34 | .. automodule:: arcrest.ags.server 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | arcrest.ags.services module 40 | --------------------------- 41 | 42 | .. automodule:: arcrest.ags.services 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | 48 | Module contents 49 | --------------- 50 | 51 | .. automodule:: arcrest.ags 52 | :members: 53 | :undoc-members: 54 | :show-inheritance: 55 | -------------------------------------------------------------------------------- /docs/arcrest.cmp.rst: -------------------------------------------------------------------------------- 1 | arcrest.cmp package 2 | =================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.cmp.community module 8 | ---------------------------- 9 | 10 | .. automodule:: arcrest.cmp.community 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.cmp 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/arcrest.common.rst: -------------------------------------------------------------------------------- 1 | arcrest.common package 2 | ====================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.common.domain module 8 | ---------------------------- 9 | 10 | .. automodule:: arcrest.common.domain 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.common.errorhandlers module 16 | ----------------------------------- 17 | 18 | .. automodule:: arcrest.common.errorhandlers 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | arcrest.common.filters module 24 | ----------------------------- 25 | 26 | .. automodule:: arcrest.common.filters 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | arcrest.common.find module 32 | -------------------------- 33 | 34 | .. automodule:: arcrest.common.find 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | arcrest.common.general module 40 | ----------------------------- 41 | 42 | .. automodule:: arcrest.common.general 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | arcrest.common.geometry module 48 | ------------------------------ 49 | 50 | .. automodule:: arcrest.common.geometry 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | arcrest.common.renderer module 56 | ------------------------------ 57 | 58 | .. automodule:: arcrest.common.renderer 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | arcrest.common.servicedef module 64 | -------------------------------- 65 | 66 | .. automodule:: arcrest.common.servicedef 67 | :members: 68 | :undoc-members: 69 | :show-inheritance: 70 | 71 | arcrest.common.spatial module 72 | ----------------------------- 73 | 74 | .. automodule:: arcrest.common.spatial 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | 79 | arcrest.common.symbology module 80 | ------------------------------- 81 | 82 | .. automodule:: arcrest.common.symbology 83 | :members: 84 | :undoc-members: 85 | :show-inheritance: 86 | 87 | 88 | Module contents 89 | --------------- 90 | 91 | .. automodule:: arcrest.common 92 | :members: 93 | :undoc-members: 94 | :show-inheritance: 95 | -------------------------------------------------------------------------------- /docs/arcrest.enrichment.rst: -------------------------------------------------------------------------------- 1 | arcrest.enrichment package 2 | ========================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: arcrest.enrichment 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | -------------------------------------------------------------------------------- /docs/arcrest.geometryservice.rst: -------------------------------------------------------------------------------- 1 | arcrest.geometryservice package 2 | =============================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.geometryservice.geometryservice module 8 | ---------------------------------------------- 9 | 10 | .. automodule:: arcrest.geometryservice.geometryservice 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.geometryservice 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/arcrest.hostedservice.rst: -------------------------------------------------------------------------------- 1 | arcrest.hostedservice package 2 | ============================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.hostedservice.service module 8 | ------------------------------------ 9 | 10 | .. automodule:: arcrest.hostedservice.service 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.hostedservice 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/arcrest.manageags.rst: -------------------------------------------------------------------------------- 1 | arcrest.manageags package 2 | ========================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.manageags.administration module 8 | --------------------------------------- 9 | 10 | .. automodule:: arcrest.manageags.administration 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.manageags.parameters module 16 | ----------------------------------- 17 | 18 | .. automodule:: arcrest.manageags.parameters 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | 24 | Module contents 25 | --------------- 26 | 27 | .. automodule:: arcrest.manageags 28 | :members: 29 | :undoc-members: 30 | :show-inheritance: 31 | -------------------------------------------------------------------------------- /docs/arcrest.manageorg.rst: -------------------------------------------------------------------------------- 1 | arcrest.manageorg package 2 | ========================= 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.manageorg.administration module 8 | --------------------------------------- 9 | 10 | .. automodule:: arcrest.manageorg.administration 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.manageorg 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/arcrest.manageportal.rst: -------------------------------------------------------------------------------- 1 | arcrest.manageportal package 2 | ============================ 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.manageportal.administration module 8 | ------------------------------------------ 9 | 10 | .. automodule:: arcrest.manageportal.administration 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.manageportal 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/arcrest.opendata.rst: -------------------------------------------------------------------------------- 1 | arcrest.opendata package 2 | ======================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.opendata.opendata module 8 | -------------------------------- 9 | 10 | .. automodule:: arcrest.opendata.opendata 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.opendata 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/arcrest.packages.ntlm3.rst: -------------------------------------------------------------------------------- 1 | arcrest.packages.ntlm3 package 2 | ============================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.packages.ntlm3.HTTPNtlmAuthHandler module 8 | ------------------------------------------------- 9 | 10 | .. automodule:: arcrest.packages.ntlm3.HTTPNtlmAuthHandler 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.packages.ntlm3.U32 module 16 | --------------------------------- 17 | 18 | .. automodule:: arcrest.packages.ntlm3.U32 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | arcrest.packages.ntlm3.compat module 24 | ------------------------------------ 25 | 26 | .. automodule:: arcrest.packages.ntlm3.compat 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | arcrest.packages.ntlm3.des module 32 | --------------------------------- 33 | 34 | .. automodule:: arcrest.packages.ntlm3.des 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | arcrest.packages.ntlm3.des_c module 40 | ----------------------------------- 41 | 42 | .. automodule:: arcrest.packages.ntlm3.des_c 43 | :members: 44 | :undoc-members: 45 | :show-inheritance: 46 | 47 | arcrest.packages.ntlm3.des_data module 48 | -------------------------------------- 49 | 50 | .. automodule:: arcrest.packages.ntlm3.des_data 51 | :members: 52 | :undoc-members: 53 | :show-inheritance: 54 | 55 | arcrest.packages.ntlm3.ntlm module 56 | ---------------------------------- 57 | 58 | .. automodule:: arcrest.packages.ntlm3.ntlm 59 | :members: 60 | :undoc-members: 61 | :show-inheritance: 62 | 63 | 64 | Module contents 65 | --------------- 66 | 67 | .. automodule:: arcrest.packages.ntlm3 68 | :members: 69 | :undoc-members: 70 | :show-inheritance: 71 | -------------------------------------------------------------------------------- /docs/arcrest.packages.rst: -------------------------------------------------------------------------------- 1 | arcrest.packages package 2 | ======================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | arcrest.packages.ntlm3 10 | 11 | Submodules 12 | ---------- 13 | 14 | arcrest.packages.six module 15 | --------------------------- 16 | 17 | .. automodule:: arcrest.packages.six 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | 23 | Module contents 24 | --------------- 25 | 26 | .. automodule:: arcrest.packages 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | -------------------------------------------------------------------------------- /docs/arcrest.rst: -------------------------------------------------------------------------------- 1 | arcrest package 2 | =============== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | arcrest.agol 10 | arcrest.ags 11 | arcrest.cmp 12 | arcrest.common 13 | arcrest.enrichment 14 | arcrest.geometryservice 15 | arcrest.hostedservice 16 | arcrest.manageags 17 | arcrest.manageorg 18 | arcrest.manageportal 19 | arcrest.opendata 20 | arcrest.packages 21 | arcrest.security 22 | arcrest.web 23 | arcrest.webmap 24 | 25 | Module contents 26 | --------------- 27 | 28 | .. automodule:: arcrest 29 | :members: 30 | :undoc-members: 31 | :show-inheritance: 32 | -------------------------------------------------------------------------------- /docs/arcrest.security.rst: -------------------------------------------------------------------------------- 1 | arcrest.security package 2 | ======================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.security.security module 8 | -------------------------------- 9 | 10 | .. automodule:: arcrest.security.security 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcrest.security 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/arcrest.web.rst: -------------------------------------------------------------------------------- 1 | arcrest.web package 2 | =================== 3 | 4 | Module contents 5 | --------------- 6 | 7 | .. automodule:: arcrest.web 8 | :members: 9 | :undoc-members: 10 | :show-inheritance: 11 | -------------------------------------------------------------------------------- /docs/arcrest.webmap.rst: -------------------------------------------------------------------------------- 1 | arcrest.webmap package 2 | ====================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcrest.webmap.domain module 8 | ---------------------------- 9 | 10 | .. automodule:: arcrest.webmap.domain 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | arcrest.webmap.operationallayers module 16 | --------------------------------------- 17 | 18 | .. automodule:: arcrest.webmap.operationallayers 19 | :members: 20 | :undoc-members: 21 | :show-inheritance: 22 | 23 | arcrest.webmap.renderer module 24 | ------------------------------ 25 | 26 | .. automodule:: arcrest.webmap.renderer 27 | :members: 28 | :undoc-members: 29 | :show-inheritance: 30 | 31 | arcrest.webmap.symbols module 32 | ----------------------------- 33 | 34 | .. automodule:: arcrest.webmap.symbols 35 | :members: 36 | :undoc-members: 37 | :show-inheritance: 38 | 39 | 40 | Module contents 41 | --------------- 42 | 43 | .. automodule:: arcrest.webmap 44 | :members: 45 | :undoc-members: 46 | :show-inheritance: 47 | -------------------------------------------------------------------------------- /docs/arcresthelper.packages.rst: -------------------------------------------------------------------------------- 1 | arcresthelper.packages package 2 | ============================== 3 | 4 | Submodules 5 | ---------- 6 | 7 | arcresthelper.packages.six module 8 | --------------------------------- 9 | 10 | .. automodule:: arcresthelper.packages.six 11 | :members: 12 | :undoc-members: 13 | :show-inheritance: 14 | 15 | 16 | Module contents 17 | --------------- 18 | 19 | .. automodule:: arcresthelper.packages 20 | :members: 21 | :undoc-members: 22 | :show-inheritance: 23 | -------------------------------------------------------------------------------- /docs/arcresthelper.rst: -------------------------------------------------------------------------------- 1 | arcresthelper package 2 | ===================== 3 | 4 | Subpackages 5 | ----------- 6 | 7 | .. toctree:: 8 | 9 | arcresthelper.packages 10 | 11 | Submodules 12 | ---------- 13 | 14 | arcresthelper.common module 15 | --------------------------- 16 | 17 | .. automodule:: arcresthelper.common 18 | :members: 19 | :undoc-members: 20 | :show-inheritance: 21 | 22 | arcresthelper.featureservicetools module 23 | ---------------------------------------- 24 | 25 | .. automodule:: arcresthelper.featureservicetools 26 | :members: 27 | :undoc-members: 28 | :show-inheritance: 29 | 30 | arcresthelper.orgtools module 31 | ----------------------------- 32 | 33 | .. automodule:: arcresthelper.orgtools 34 | :members: 35 | :undoc-members: 36 | :show-inheritance: 37 | 38 | arcresthelper.portalautomation module 39 | ------------------------------------- 40 | 41 | .. automodule:: arcresthelper.portalautomation 42 | :members: 43 | :undoc-members: 44 | :show-inheritance: 45 | 46 | arcresthelper.publishingtools module 47 | ------------------------------------ 48 | 49 | .. automodule:: arcresthelper.publishingtools 50 | :members: 51 | :undoc-members: 52 | :show-inheritance: 53 | 54 | arcresthelper.resettools module 55 | ------------------------------- 56 | 57 | .. automodule:: arcresthelper.resettools 58 | :members: 59 | :undoc-members: 60 | :show-inheritance: 61 | 62 | arcresthelper.securityhandlerhelper module 63 | ------------------------------------------ 64 | 65 | .. automodule:: arcresthelper.securityhandlerhelper 66 | :members: 67 | :undoc-members: 68 | :show-inheritance: 69 | 70 | 71 | Module contents 72 | --------------- 73 | 74 | .. automodule:: arcresthelper 75 | :members: 76 | :undoc-members: 77 | :show-inheritance: 78 | -------------------------------------------------------------------------------- /docs/index.rst: -------------------------------------------------------------------------------- 1 | .. src documentation master file, created by 2 | sphinx-quickstart on Wed Feb 17 07:05:59 2016. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Welcome to src's documentation! 7 | =============================== 8 | 9 | Contents: 10 | 11 | .. toctree:: 12 | :maxdepth: 4 13 | 14 | arcrest 15 | arcresthelper 16 | setup 17 | setup_wheel 18 | 19 | 20 | Indices and tables 21 | ================== 22 | 23 | * :ref:`genindex` 24 | * :ref:`modindex` 25 | * :ref:`search` 26 | 27 | -------------------------------------------------------------------------------- /docs/setup.rst: -------------------------------------------------------------------------------- 1 | setup module 2 | ============ 3 | 4 | .. automodule:: setup 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /docs/setup_wheel.rst: -------------------------------------------------------------------------------- 1 | setup_wheel module 2 | ================== 3 | 4 | .. automodule:: setup_wheel 5 | :members: 6 | :undoc-members: 7 | :show-inheritance: 8 | -------------------------------------------------------------------------------- /notebooks/ArcREST Basics - Logining into the Site.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "\"\"\"\n", 12 | "\n", 13 | " Common Login Methods\n", 14 | "\n", 15 | "\"\"\"\n", 16 | "import arcrest\n", 17 | "username = \"SomeUserName\"\n", 18 | "password = \"SomePassword\"\n", 19 | "org_url = \"https://chronus.esri.com/portal\"\n" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 2, 25 | "metadata": { 26 | "collapsed": true 27 | }, 28 | "outputs": [], 29 | "source": [ 30 | "\"\"\"\n", 31 | "BUILT-IN security is AGOL, Portal and Servers default login method. \n", 32 | "This is just a simple username/password use case that returns a token\n", 33 | "\"\"\"\n", 34 | "\n", 35 | "#AGOL Login\n", 36 | "sh = arcrest.AGOLTokenSecurityHandler(username=username, \n", 37 | " password=password)\n", 38 | "\n", 39 | "#Portal Login\n", 40 | "sh = arcrest.PortalTokenSecurityHandler(username=username, \n", 41 | " password=password, \n", 42 | " org_url=org_url)\n", 43 | "\n", 44 | "#ArcGIS Server Login\n", 45 | "sh = arcrest.AGSTokenSecurityHandler(username=username,\n", 46 | " password=password,\n", 47 | " org_url=\"https://chronus.esri.com/arcgis\")\n" 48 | ] 49 | }, 50 | { 51 | "cell_type": "code", 52 | "execution_count": null, 53 | "metadata": { 54 | "collapsed": true 55 | }, 56 | "outputs": [], 57 | "source": [ 58 | "\"\"\"\n", 59 | "You can secure access to your server/portal using Lightweight Directory Access Protocol (LDAP). \n", 60 | "When you use LDAP, logins are managed through your organization's LDAP server.\n", 61 | "\"\"\"\n", 62 | "\n", 63 | "#LDAP Login\n", 64 | "sh = arcrest.LDAPSecurityHandler(org_url=org_url, \n", 65 | " username=\"AVWORLD\\\\testaccount\", \n", 66 | " password=password)\n", 67 | "\n", 68 | "\"\"\"\n", 69 | "Using ArcGIS Desktop (SAML work around)\n", 70 | "\"\"\"\n", 71 | "sh = arcrest.ArcGISTokenSecurityHandler()\n", 72 | "\n", 73 | "\"\"\"\n", 74 | "PKI - A public key infrastructure (PKI) is a set of roles, policies, and procedures needed to create, manage, \n", 75 | "distribute, use, store, and revoke digital certificates and manage public-key encryption\n", 76 | "\"\"\"\n", 77 | "sh = arcrest.PKISecurityHandler(org_url=org_url, \n", 78 | " keyfile=r\"\", \n", 79 | " certificatefile=r\"\")\n" 80 | ] 81 | } 82 | ], 83 | "metadata": { 84 | "kernelspec": { 85 | "display_name": "Python 3", 86 | "language": "python", 87 | "name": "python3" 88 | }, 89 | "language_info": { 90 | "codemirror_mode": { 91 | "name": "ipython", 92 | "version": 3 93 | }, 94 | "file_extension": ".py", 95 | "mimetype": "text/x-python", 96 | "name": "python", 97 | "nbconvert_exporter": "python", 98 | "pygments_lexer": "ipython3", 99 | "version": "3.5.1" 100 | } 101 | }, 102 | "nbformat": 4, 103 | "nbformat_minor": 0 104 | } 105 | -------------------------------------------------------------------------------- /notebooks/Demo 1 - List Current Users Content.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 4, 6 | "metadata": { 7 | "collapsed": false 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import arcrest" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 7, 17 | "metadata": { 18 | "collapsed": true 19 | }, 20 | "outputs": [], 21 | "source": [ 22 | "username = \"\"\n", 23 | "password = \"\"\n", 24 | "sh = arcrest.AGOLTokenSecurityHandler(username=username, password=password)\n", 25 | "admin = arcrest.manageorg.Administration(securityHandler=sh)\n", 26 | "content = admin.content" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 19, 32 | "metadata": { 33 | "collapsed": true 34 | }, 35 | "outputs": [], 36 | "source": [ 37 | "# Get the logged in user\n", 38 | "currentUser= content.users.user()" 39 | ] 40 | }, 41 | { 42 | "cell_type": "code", 43 | "execution_count": 20, 44 | "metadata": { 45 | "collapsed": false 46 | }, 47 | "outputs": [ 48 | { 49 | "name": "stdout", 50 | "output_type": "stream", 51 | "text": [ 52 | "--------------------------------------------\n", 53 | "In folder: root\n", 54 | " - guam_replication\n", 55 | " - fgsjklklj\n", 56 | " - Zelda Slide Notes\n", 57 | " - A very large fgdb\n", 58 | " - oauth4juypter\n", 59 | " - fdpopo\n", 60 | " - test test\n", 61 | " - guam_replication\n", 62 | " - testasdfasdfass\n", 63 | " - mapsasd\n", 64 | " - zelda_map\n", 65 | " - ZeldaMap\n", 66 | " - Scripting REST\n", 67 | "\n", 68 | " - rtwserkkk\n", 69 | " - ZeldaMap\n", 70 | "--------------------------------------------\n", 71 | "In folder: Pdfs\n", 72 | " - guam\n", 73 | " - guam\n", 74 | "--------------------------------------------\n", 75 | "In folder: randomFolder\n", 76 | " - guamds\n" 77 | ] 78 | } 79 | ], 80 | "source": [ 81 | "# Iterate through all content in each folder\n", 82 | "for folder in currentUser.folders:\n", 83 | " currentUser.currentFolder =folder['title']\n", 84 | " print ('--------------------------------------------')\n", 85 | " print (\"In folder: %s\" % folder['title'])\n", 86 | " for item in currentUser.items:\n", 87 | " print(\" - %s\" % item.title)" 88 | ] 89 | }, 90 | { 91 | "cell_type": "code", 92 | "execution_count": null, 93 | "metadata": { 94 | "collapsed": true 95 | }, 96 | "outputs": [], 97 | "source": [] 98 | } 99 | ], 100 | "metadata": { 101 | "kernelspec": { 102 | "display_name": "Python 3", 103 | "language": "python", 104 | "name": "python3" 105 | }, 106 | "language_info": { 107 | "codemirror_mode": { 108 | "name": "ipython", 109 | "version": 3 110 | }, 111 | "file_extension": ".py", 112 | "mimetype": "text/x-python", 113 | "name": "python", 114 | "nbconvert_exporter": "python", 115 | "pygments_lexer": "ipython3", 116 | "version": "3.5.1" 117 | } 118 | }, 119 | "nbformat": 4, 120 | "nbformat_minor": 0 121 | } 122 | -------------------------------------------------------------------------------- /notebooks/Demo 5 - Erasing Content on Portal.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 13, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import arcrest" 12 | ] 13 | }, 14 | { 15 | "cell_type": "code", 16 | "execution_count": 14, 17 | "metadata": { 18 | "collapsed": false 19 | }, 20 | "outputs": [], 21 | "source": [ 22 | "sh = arcrest.AGOLTokenSecurityHandler(\"\", \"\")\n", 23 | "admin = arcrest.manageorg.Administration(securityHandler=sh)\n", 24 | "\n" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": 15, 30 | "metadata": { 31 | "collapsed": false 32 | }, 33 | "outputs": [], 34 | "source": [ 35 | "user = admin.content.users.user()" 36 | ] 37 | }, 38 | { 39 | "cell_type": "code", 40 | "execution_count": 16, 41 | "metadata": { 42 | "collapsed": false 43 | }, 44 | "outputs": [], 45 | "source": [ 46 | "erase_items = []\n", 47 | "for item in user.items:\n", 48 | " if item.type == \"Web Map\":\n", 49 | " erase_items.append(item.id)" 50 | ] 51 | }, 52 | { 53 | "cell_type": "code", 54 | "execution_count": 19, 55 | "metadata": { 56 | "collapsed": false 57 | }, 58 | "outputs": [ 59 | { 60 | "name": "stdout", 61 | "output_type": "stream", 62 | "text": [ 63 | "{u'results': [{u'itemId': u'07b775d5f0da4ffdb07502fffe644d90', u'success': True}]}\n" 64 | ] 65 | } 66 | ], 67 | "source": [ 68 | "if len(erase_items) > 0:\n", 69 | " items = \";\".join(erase_items)\n", 70 | " print (user.deleteItems(items=items))\n" 71 | ] 72 | }, 73 | { 74 | "cell_type": "code", 75 | "execution_count": null, 76 | "metadata": { 77 | "collapsed": true 78 | }, 79 | "outputs": [], 80 | "source": [] 81 | } 82 | ], 83 | "metadata": { 84 | "kernelspec": { 85 | "display_name": "Python 2", 86 | "language": "python", 87 | "name": "python2" 88 | }, 89 | "language_info": { 90 | "codemirror_mode": { 91 | "name": "ipython", 92 | "version": 2 93 | }, 94 | "file_extension": ".py", 95 | "mimetype": "text/x-python", 96 | "name": "python", 97 | "nbconvert_exporter": "python", 98 | "pygments_lexer": "ipython2", 99 | "version": "2.7.10" 100 | } 101 | }, 102 | "nbformat": 4, 103 | "nbformat_minor": 0 104 | } 105 | -------------------------------------------------------------------------------- /notebooks/Demo 6 - Disable a Portal or AGOL User Account.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 8, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import arcrest\n", 12 | "username = \"\"\n", 13 | "password = \"\"\n", 14 | "user_to_disable = \"disabled_account\"\n", 15 | "sh = arcrest.AGOLTokenSecurityHandler(username, password)\n", 16 | "admin = arcrest.manageorg.Administration(securityHandler=sh)" 17 | ] 18 | }, 19 | { 20 | "cell_type": "code", 21 | "execution_count": 9, 22 | "metadata": { 23 | "collapsed": false 24 | }, 25 | "outputs": [ 26 | { 27 | "name": "stdout", 28 | "output_type": "stream", 29 | "text": [ 30 | "{u'success': True}\n" 31 | ] 32 | } 33 | ], 34 | "source": [ 35 | "com = admin.community\n", 36 | "user = com.users.user(user_to_disable)\n", 37 | "print(user.disable())" 38 | ] 39 | }, 40 | { 41 | "cell_type": "code", 42 | "execution_count": 10, 43 | "metadata": { 44 | "collapsed": false 45 | }, 46 | "outputs": [ 47 | { 48 | "data": { 49 | "text/plain": [ 50 | "{u'error': {u'code': 405,\n", 51 | " u'details': [],\n", 52 | " u'message': u'Method not supported.',\n", 53 | " u'messageCode': u'GWM_0005'}}" 54 | ] 55 | }, 56 | "execution_count": 10, 57 | "metadata": {}, 58 | "output_type": "execute_result" 59 | } 60 | ], 61 | "source": [ 62 | "user.enable()" 63 | ] 64 | }, 65 | { 66 | "cell_type": "code", 67 | "execution_count": null, 68 | "metadata": { 69 | "collapsed": true 70 | }, 71 | "outputs": [], 72 | "source": [] 73 | } 74 | ], 75 | "metadata": { 76 | "kernelspec": { 77 | "display_name": "Python 2", 78 | "language": "python", 79 | "name": "python2" 80 | }, 81 | "language_info": { 82 | "codemirror_mode": { 83 | "name": "ipython", 84 | "version": 2 85 | }, 86 | "file_extension": ".py", 87 | "mimetype": "text/x-python", 88 | "name": "python", 89 | "nbconvert_exporter": "python", 90 | "pygments_lexer": "ipython2", 91 | "version": "2.7.10" 92 | } 93 | }, 94 | "nbformat": 4, 95 | "nbformat_minor": 0 96 | } 97 | -------------------------------------------------------------------------------- /samples/AGOLMapServices/tileserviceproperties.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample will show the user the properties of a 3 | hosted map service (tiled service) on AGOL. 4 | """ 5 | import arcrest 6 | 7 | if __name__ == "__main__": 8 | url = "https:///arcgis/rest/admin" 9 | username = "" 10 | password = "" 11 | 12 | sh = arcrest.AGOLTokenSecurityHandler(username, password) 13 | agolServices = arcrest.hostedservice.Services(url, securityHandler=sh) 14 | for service in agolServices.services: 15 | if isinstance(service, arcrest.hostedservice.AdminMapService): 16 | print service.id 17 | print service.urlService 18 | print service.name -------------------------------------------------------------------------------- /samples/AGS/agsserverObjectExample.py: -------------------------------------------------------------------------------- 1 | """ 2 | Demonstrates some simple usage of the ags.agsserver object. 3 | New at version 3 of ArcREST 4 | """ 5 | import arcrest 6 | 7 | url = "https://:6443/arcgis" 8 | sh = arcrest.AGSTokenSecurityHandler(username="", password="", org_url=url) 9 | server = arcrest.ags.server.Server(url=url, 10 | securityHandler=sh) 11 | # Access the AGSAdminstration Class 12 | # 13 | adminAGS = server.admin 14 | print adminAGS.currentVersion 15 | print adminAGS.clusters 16 | # Walk all the folders and 17 | # print out the raw JSON response 18 | # for each service and the url 19 | for folder in server.folders: 20 | server.currentFolder = folder 21 | for service in server.services: 22 | print '----------------------' 23 | print service.url 24 | print str(service) 25 | print '----------------------' -------------------------------------------------------------------------------- /samples/AGS/serverDetails.py: -------------------------------------------------------------------------------- 1 | from arcrest.security.security import AGSTokenSecurityHandler 2 | from arcrest.manageags import AGSAdministration 3 | 4 | def trace(): 5 | """ 6 | trace finds the line, the filename 7 | and error message and returns it 8 | to the user 9 | """ 10 | import traceback, inspect, sys 11 | tb = sys.exc_info()[2] 12 | tbinfo = traceback.format_tb(tb)[0] 13 | filename = inspect.getfile(inspect.currentframe()) 14 | # script name + line number 15 | line = tbinfo.split(", ")[1] 16 | # Get Python syntax error 17 | # 18 | synerror = traceback.format_exc().splitlines()[-1] 19 | return line, filename, synerror 20 | 21 | if __name__ == "__main__": 22 | username = "" 23 | password = "" 24 | url = "https://arcrestdev1.esri.com/arcgis/admin/" 25 | 26 | try: 27 | sh = AGSTokenSecurityHandler(username=username, 28 | password=password, 29 | org_url="http://arcrestdev1.esri.com/arcgis", 30 | token_url=None, 31 | proxy_url=None, 32 | proxy_port=None) 33 | print sh.token 34 | ags = AGSAdministration(url=url, 35 | securityHandler=sh, 36 | proxy_url=None, 37 | proxy_port=None) 38 | print ags.data 39 | 40 | except: 41 | line, filename, synerror = trace() 42 | print "error on line: %s" % line 43 | print "error in file name: %s" % filename 44 | print "with error message: %s" % synerror -------------------------------------------------------------------------------- /samples/AGS/serverSecurityConfig.py: -------------------------------------------------------------------------------- 1 | from arcrest.security.security import AGSTokenSecurityHandler 2 | from arcrest.manageags import AGSAdministration 3 | 4 | if __name__ == "__main__": 5 | username = "" 6 | password = "" 7 | url = "" 8 | 9 | sh = AGSTokenSecurityHandler(username=username, 10 | password=password, 11 | token_url=url + '/tokens/', 12 | proxy_url=None, 13 | proxy_port=None) 14 | 15 | ags = AGSAdministration(url=url, 16 | securityHandler=sh, 17 | proxy_url=None, 18 | proxy_port=None) 19 | 20 | security_cfg = ags.security.securityConfig 21 | print(security_cfg) 22 | 23 | if 'sslEnabled' in security_cfg: 24 | security_cfg['sslEnabled'] = False 25 | 26 | if 'httpEnabled' in security_cfg: 27 | security_cfg['httpEnabled'] = True 28 | 29 | res = ags.security.updateSecurityConfig(security_cfg) 30 | print(res) 31 | -------------------------------------------------------------------------------- /samples/Change Map Service Scheme.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows users how to add a map service via URL, then 3 | update that item's URL from http scheme to https. 4 | 5 | This method will work for both Portal and ArcGIS Online 6 | 7 | Python 2/3 8 | ArcREST 3.5.x 9 | """ 10 | from __future__ import print_function 11 | import arcrest 12 | 13 | if __name__ == "__main__": 14 | username = "" 15 | password = "" 16 | org_url = "" 17 | url = "http://sampleserver6.arcgisonline.com/arcgis/rest/services/MontgomeryQuarters/MapServer" 18 | # Create a security handler for portal 19 | # 20 | sh = arcrest.PortalTokenSecurityHandler(username=username, 21 | password=password, 22 | org_url=org_url) 23 | # Access the admin side of the site 24 | # 25 | admin = arcrest.manageorg.Administration(url=org_url, securityHandler=sh) 26 | content = admin.content 27 | users = content.users 28 | user = users.user(username=username) 29 | ip = arcrest.manageorg.ItemParameter() 30 | ip.title = "MontgomeryQuarters" 31 | ip.description = "Represents a simple map service" 32 | ip.tags = "MapService" 33 | ip.type = "Map Service" 34 | item = user.addItem(itemParameters=ip, 35 | url=url) 36 | item.updateItem(itemParameters=arcrest.manageorg.ItemParameter(), serviceUrl=url.replace("http://", "https://") + "#") 37 | item.updateItem(itemParameters=arcrest.manageorg.ItemParameter(), serviceUrl=url.replace("http://", "https://")) 38 | -------------------------------------------------------------------------------- /samples/HostedFeatureServiceAdmin/addDomainToHostedFeatureService.py: -------------------------------------------------------------------------------- 1 | """ 2 | Adds a domain to the specified field in any layer matching the name in all feature services 3 | without republishing 4 | """ 5 | import arcrest 6 | 7 | if __name__ == "__main__": 8 | url = "https:///ArcGIS/rest/admin" 9 | username = "" 10 | password = "" 11 | featureLayerNames = ["layername"] # must be all lowercase 12 | definition = { 13 | "fields": [ 14 | { 15 | "name": "Type", 16 | "domain": { 17 | "type": "codedValue", 18 | "name": "Type", 19 | "codedValues": [ 20 | { 21 | "name": "Option A", 22 | "code": "type_a" 23 | }, 24 | { 25 | "name": "Option B", 26 | "code": "type_b" 27 | }, 28 | { 29 | "name": "Option C", 30 | "code": "type_c" 31 | } 32 | ] 33 | } 34 | } 35 | ] 36 | } 37 | 38 | sh = arcrest.AGOLTokenSecurityHandler(username, password) 39 | agolServices = arcrest.hostedservice.Services(url, securityHandler=sh) 40 | for service in agolServices.services: 41 | if not service.layers is None: 42 | print service.url 43 | for lyr in service.layers: 44 | print lyr.name 45 | 46 | if lyr.name.lower() in featureLayerNames: 47 | print lyr.updateDefinition(definition) 48 | # Output: {'success': True} -------------------------------------------------------------------------------- /samples/HostedFeatureServiceAdmin/addFieldToHostedFeatureService.py: -------------------------------------------------------------------------------- 1 | """ 2 | Adds a field to any layer matching the name in all feature services without 3 | republishing 4 | """ 5 | import arcrest 6 | 7 | if __name__ == "__main__": 8 | url = "https:///ArcGIS/rest/admin" 9 | username = "" 10 | password = " " 11 | featureLayerNames = ["layerName1","layerName2"] 12 | fieldToAdd = { 13 | 14 | "fields" : [ 15 | { 16 | "name" : "CommonField3", 17 | "type" : "esriFieldTypeString", 18 | "alias" : "Common Field 2", 19 | "sqlType" : "sqlTypeOther", "length" : 50, 20 | "nullable" : True, 21 | "editable" : True, 22 | "domain" : None, 23 | "defaultValue" : None 24 | } ] 25 | } 26 | sh = arcrest.AGOLTokenSecurityHandler(username, password) 27 | agolServices = arcrest.hostedservice.Services(url, securityHandler=sh) 28 | for service in agolServices.services: 29 | if not service.layers is None: 30 | print service.url 31 | for lyr in service.layers: 32 | print lyr.name 33 | 34 | if lyr.name.lower() in featureLayerNames: 35 | print lyr.addToDefinition(fieldToAdd) 36 | # Output: {'success': True} -------------------------------------------------------------------------------- /samples/HostedFeatureServiceAdmin/listLayersInHostedFeatureService.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | Simple sample that lists all layers in a given hosted feature service 4 | 5 | """ 6 | import arcrest 7 | 8 | if __name__ == "__main__": 9 | url = "https:///ArcGIS/rest/admin" 10 | username = "" 11 | password = " " 12 | sh = arcrest.AGOLTokenSecurityHandler(username, password) 13 | agolServices = arcrest.hostedservice.Services(url, securityHandler=sh) 14 | for service in agolServices.services: 15 | for lyr in service.layers: 16 | print lyr.name, lyr._url -------------------------------------------------------------------------------- /samples/Workforce/dataToLoad.csv: -------------------------------------------------------------------------------- 1 | description,status,notes,priority,assignmentType,workOrderId,dueDate,location,x,y 2 | Test Assignment,0,Test Notes,1,1,123,1/28/2016 4:59:59 AM,Sample Loc Info,-88.1504416227191,41.7798509169729 3 | Test Assignement,0,Teest Notes,1,1,123,1/28/2016 4:59:59 AM,Samplee Loc Info,-88.1204416227191,41.7398509169729 4 | -------------------------------------------------------------------------------- /samples/Workforce/dataToLookup.csv: -------------------------------------------------------------------------------- 1 | worker,area,description,notes,supervisor 2 | Rachel Weeden,32,I love chicken,123,Daniel Wickens 3 | Rachel Weeden,11,Rachels Second,123,Daniel Wickens 4 | Carl Nylen,12,Boston Strong,123,Daniel Wickens 5 | -------------------------------------------------------------------------------- /samples/Workforce/query_completed_work.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows to query completed workforce work 3 | 4 | Python 2.x/3.x 5 | ArcREST 3.5 6 | """ 7 | from __future__ import print_function 8 | import arcrest 9 | from arcresthelper import featureservicetools 10 | from arcresthelper import common 11 | 12 | def trace(): 13 | """ 14 | trace finds the line, the filename 15 | and error message and returns it 16 | to the user 17 | """ 18 | import traceback, inspect, sys 19 | tb = sys.exc_info()[2] 20 | tbinfo = traceback.format_tb(tb)[0] 21 | filename = inspect.getfile(inspect.currentframe()) 22 | # script name + line number 23 | line = tbinfo.split(", ")[1] 24 | # Get Python syntax error 25 | # 26 | synerror = traceback.format_exc().splitlines()[-1] 27 | return line, filename, synerror 28 | 29 | def main(): 30 | proxy_port = None 31 | proxy_url = None 32 | 33 | securityinfo = {} 34 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 35 | securityinfo['username'] = ""# 36 | securityinfo['password'] = ""# 37 | securityinfo['org_url'] = "http://www.arcgis.com" 38 | securityinfo['proxy_url'] = proxy_url 39 | securityinfo['proxy_port'] = proxy_port 40 | securityinfo['referer_url'] = None 41 | securityinfo['token_url'] = None 42 | securityinfo['certificatefile'] = None 43 | securityinfo['keyfile'] = None 44 | securityinfo['client_id'] = None 45 | securityinfo['secret_id'] = None 46 | 47 | 48 | itemId = ""# 49 | sql = "status = 3" #Completed work 50 | saveLocation = r"c:\temp\completedWork.gdb" #GDB or folder to save result 51 | outName = "completedWork" #Name of result 52 | 53 | try: 54 | 55 | fst = featureservicetools.featureservicetools(securityinfo) 56 | if fst.valid == False: 57 | print (fst.message) 58 | else: 59 | fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) 60 | if not fs is None: 61 | fls = fs.layers 62 | if len(fls) > 0 : 63 | fl = fls[0] 64 | res = fst.QueryAllFeatures(url=fl.url, 65 | sql=sql, 66 | chunksize=300, 67 | saveLocation=saveLocation, 68 | outName=outName) 69 | print (res) 70 | 71 | except (common.ArcRestHelperError),e: 72 | print ("error in function: %s" % e[0]['function']) 73 | print ("error on line: %s" % e[0]['line']) 74 | print ("error in file name: %s" % e[0]['filename']) 75 | print ("with error message: %s" % e[0]['synerror']) 76 | if 'arcpyError' in e[0]: 77 | print ("with arcpy message: %s" % e[0]['arcpyError']) 78 | 79 | except: 80 | line, filename, synerror = trace() 81 | print ("error on line: %s" % line) 82 | print ("error in file name: %s" % filename) 83 | print ("with error message: %s" % synerror) 84 | 85 | if __name__ == "__main__": 86 | main() -------------------------------------------------------------------------------- /samples/Workforce/query_delete_completed_work.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | This sample shows to query and delete 4 | completed workforce work 5 | 6 | Python 2.x/3.x 7 | ArcREST 3.5 8 | """ 9 | from __future__ import print_function 10 | import arcrest 11 | from arcresthelper import featureservicetools 12 | from arcresthelper import common 13 | 14 | def trace(): 15 | """ 16 | trace finds the line, the filename 17 | and error message and returns it 18 | to the user 19 | """ 20 | import traceback, inspect, sys 21 | tb = sys.exc_info()[2] 22 | tbinfo = traceback.format_tb(tb)[0] 23 | filename = inspect.getfile(inspect.currentframe()) 24 | # script name + line number 25 | line = tbinfo.split(", ")[1] 26 | # Get Python syntax error 27 | # 28 | synerror = traceback.format_exc().splitlines()[-1] 29 | return line, filename, synerror 30 | 31 | def main(): 32 | proxy_port = None 33 | proxy_url = None 34 | 35 | securityinfo = {} 36 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 37 | securityinfo['username'] = ""# 38 | securityinfo['password'] = ""# 39 | securityinfo['org_url'] = "http://www.arcgis.com" 40 | securityinfo['proxy_url'] = proxy_url 41 | securityinfo['proxy_port'] = proxy_port 42 | securityinfo['referer_url'] = None 43 | securityinfo['token_url'] = None 44 | securityinfo['certificatefile'] = None 45 | securityinfo['keyfile'] = None 46 | securityinfo['client_id'] = None 47 | securityinfo['secret_id'] = None 48 | 49 | 50 | itemId = ""# 51 | sql = "status = 3" #Completed work 52 | saveLocation = r"c:\temp\completedWork.gdb" #GDB or folder to save result 53 | outName = "completedWork" #Name of result 54 | 55 | try: 56 | 57 | fst = featureservicetools.featureservicetools(securityinfo) 58 | if fst.valid == False: 59 | print (fst.message) 60 | else: 61 | fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) 62 | if not fs is None: 63 | fls = fs.layers 64 | if len(fls) > 0 : 65 | fl = fls[0] 66 | 67 | res = fst.QueryAllFeatures(url=fl.url, 68 | sql=sql, 69 | chunksize=300, 70 | saveLocation=saveLocation, 71 | outName=outName) 72 | print (res) 73 | res = fst.DeleteFeaturesFromFeatureLayer(url=fl.url, sql=sql) 74 | print (res) 75 | 76 | except (common.ArcRestHelperError),e: 77 | print ("error in function: %s" % e[0]['function']) 78 | print ("error on line: %s" % e[0]['line']) 79 | print ("error in file name: %s" % e[0]['filename']) 80 | print ("with error message: %s" % e[0]['synerror']) 81 | if 'arcpyError' in e[0]: 82 | print ("with arcpy message: %s" % e[0]['arcpyError']) 83 | 84 | except: 85 | line, filename, synerror = trace() 86 | print ("error on line: %s" % line) 87 | print ("error in file name: %s" % filename) 88 | print ("with error message: %s" % synerror) 89 | 90 | if __name__ == "__main__": 91 | main() -------------------------------------------------------------------------------- /samples/addItem_kml_sample.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to add an item to 3 | AGOL/Portal using ArcREST 4 | ArcREST version 3.5.x 5 | Python 2/3 6 | """ 7 | from __future__ import print_function 8 | import arcrest 9 | 10 | if __name__ == "__main__": 11 | username = "" 12 | password = "" 13 | portalId = "" 14 | url = "" 15 | thumbnail_url = "" 16 | kml_path = r"" 17 | securityHandler = arcrest.AGOLTokenSecurityHandler(username, 18 | password) 19 | # Create the administration connection 20 | # 21 | admin = arcrest.manageorg.Administration(url, securityHandler) 22 | # Access the content properties to add the item 23 | # 24 | content = admin.content 25 | # Access the user to add the item to 26 | # 27 | user = content.users.user() # gets the logged in user. 28 | # Provide the item parameters 29 | # 30 | 31 | itemParams = arcrest.manageorg.ItemParameter() 32 | itemParams.thumbnailurl = thumbnail_url 33 | itemParams.title = "KML FILE" 34 | itemParams.type = "KML" 35 | itemParams.tags = "KML,Google,test" 36 | # Add the item 37 | # 38 | print (user.addItem(filePath=kml_path, 39 | itemParameters=itemParams)) 40 | -------------------------------------------------------------------------------- /samples/add_field_layer.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | This sample shows how to add a field to a set of layers 4 | from their rest services url 5 | version 3.5.x 6 | Python 2/3 7 | 8 | """ 9 | from __future__ import print_function 10 | from arcrest.security import AGOLTokenSecurityHandler 11 | from arcrest.agol import FeatureLayer 12 | 13 | if __name__ == "__main__": 14 | username = "" 15 | password = "" 16 | urls = ["url to layer","url to layer"] 17 | proxy_port = None 18 | proxy_url = None 19 | 20 | agolSH = AGOLTokenSecurityHandler(username=username, 21 | password=password) 22 | 23 | for url in urls: 24 | fl = FeatureLayer( 25 | url=url, 26 | securityHandler=agolSH, 27 | proxy_port=proxy_port, 28 | proxy_url=proxy_url, 29 | initialize=True) 30 | adminFl = fl.administration 31 | fieldToAdd = { 32 | 33 | "fields" : [ 34 | { 35 | "name" : "CommonField2", 36 | "type" : "esriFieldTypeString", 37 | "alias" : "Common Field 2", 38 | "sqlType" : "sqlTypeOther", "length" : 50, 39 | "nullable" : True, 40 | "editable" : True, 41 | "domain" : None, 42 | "defaultValue" : None 43 | } ] 44 | } 45 | print (adminFl.addToDefinition(fieldToAdd)) 46 | -------------------------------------------------------------------------------- /samples/add_file_geodatabase.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from __future__ import absolute_import 3 | import arcrest 4 | 5 | if __name__ == "__main__": 6 | sh = arcrest.AGOLTokenSecurityHandler(username="username", password="password") 7 | admin = arcrest.manageorg.Administration(securityHandler=sh) 8 | user = admin.content.users.user() 9 | ip = arcrest.manageorg.ItemParameter() 10 | ip.title = "A very large fgdb" 11 | ip.type = "File Geodatabase" 12 | ip.tags = "fgdb" 13 | ip.description = "description" 14 | ip.snippet = "snippet" 15 | res = user.addItem(itemParameters=ip, 16 | filePath=r"C:\temp3\40a87ec04f334df8bd92d9842f19570f.zip", 17 | multipart=True) 18 | 19 | # the result object is a UserItem object, not JSON. This is for version 3.5.3/3.5.4 20 | -------------------------------------------------------------------------------- /samples/add_user_group.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to add a user to a group 3 | Python 2/3 4 | ArcREST 3.5.1 5 | """ 6 | from __future__ import print_function 7 | import arcrest 8 | from arcresthelper import securityhandlerhelper 9 | from arcresthelper import common 10 | def trace(): 11 | """ 12 | trace finds the line, the filename 13 | and error message and returns it 14 | to the user 15 | """ 16 | import traceback, inspect, sys 17 | tb = sys.exc_info()[2] 18 | tbinfo = traceback.format_tb(tb)[0] 19 | filename = inspect.getfile(inspect.currentframe()) 20 | # script name + line number 21 | line = tbinfo.split(", ")[1] 22 | # Get Python syntax error 23 | # 24 | synerror = traceback.format_exc().splitlines()[-1] 25 | return line, filename, synerror 26 | 27 | def main(): 28 | proxy_port = None 29 | proxy_url = None 30 | 31 | securityinfo = {} 32 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 33 | securityinfo['username'] = ""# 34 | securityinfo['password'] = ""# 35 | securityinfo['org_url'] = "http://www.arcgis.com" 36 | securityinfo['proxy_url'] = proxy_url 37 | securityinfo['proxy_port'] = proxy_port 38 | securityinfo['referer_url'] = None 39 | securityinfo['token_url'] = None 40 | securityinfo['certificatefile'] = None 41 | securityinfo['keyfile'] = None 42 | securityinfo['client_id'] = None 43 | securityinfo['secret_id'] = None 44 | 45 | username = "" #Username to add 46 | groupname = "" #Group Name 47 | 48 | try: 49 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) 50 | if shh.valid == False: 51 | print (shh.message) 52 | else: 53 | admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) 54 | community = admin.community 55 | groups = community.groups 56 | groupIds = community.getGroupIDs(groupNames=groupname) 57 | if groupIds is None: 58 | print ("Group not found") 59 | if len(groupIds) == 0: 60 | print ("Group not found") 61 | groupId = groupIds[0] 62 | 63 | group = groups.group(groupId=groupId) 64 | if group is None: 65 | print ("Group not found") 66 | res = group.addUsersToGroups(users=username) 67 | 68 | print (res) 69 | except (common.ArcRestHelperError),e: 70 | print ("error in function: %s" % e[0]['function']) 71 | print ("error on line: %s" % e[0]['line']) 72 | print ("error in file name: %s" % e[0]['filename']) 73 | print ("with error message: %s" % e[0]['synerror']) 74 | if 'arcpyError' in e[0]: 75 | print ("with arcpy message: %s" % e[0]['arcpyError']) 76 | 77 | except: 78 | line, filename, synerror = trace() 79 | print ("error on line: %s" % line) 80 | print ("error in file name: %s" % filename) 81 | print ("with error message: %s" % synerror) 82 | 83 | if __name__ == "__main__": 84 | main() -------------------------------------------------------------------------------- /samples/add_users.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to add users to an org 3 | version 3.0.1 4 | Python 2 5 | """ 6 | import arcrest 7 | from arcresthelper import securityhandlerhelper 8 | from arcrest import manageorg 9 | 10 | def trace(): 11 | """ 12 | trace finds the line, the filename 13 | and error message and returns it 14 | to the user 15 | """ 16 | import traceback, inspect, sys 17 | tb = sys.exc_info()[2] 18 | tbinfo = traceback.format_tb(tb)[0] 19 | filename = inspect.getfile(inspect.currentframe()) 20 | # script name + line number 21 | line = tbinfo.split(", ")[1] 22 | # Get Python syntax error 23 | # 24 | synerror = traceback.format_exc().splitlines()[-1] 25 | return line, filename, synerror 26 | 27 | def main(): 28 | proxy_port = None 29 | proxy_url = None 30 | 31 | securityinfo = {} 32 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 33 | securityinfo['username'] = "" 34 | securityinfo['password'] = "" 35 | securityinfo['org_url'] = "http://www.arcgis.com" 36 | securityinfo['proxy_url'] = proxy_url 37 | securityinfo['proxy_port'] = proxy_port 38 | securityinfo['referer_url'] = None 39 | securityinfo['token_url'] = None 40 | securityinfo['certificatefile'] = None 41 | securityinfo['keyfile'] = None 42 | securityinfo['client_id'] = None 43 | securityinfo['secret_id'] = None 44 | 45 | try: 46 | 47 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo) 48 | if shh.valid == False: 49 | print shh.message 50 | else: 51 | admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) 52 | portal = admin.portals.portalSelf 53 | invList = manageorg.InvitationList() 54 | #Make sure to adhere to the password requirements 55 | #Make sure the user name is available 56 | invList.addUser(username="MyFakeUser", password="1TestTestTestTest", firstname="Test", lastname="Test", 57 | email="test@test.com", role="account_user") 58 | res = portal.addUser(invitationList=invList, 59 | subject="test", html="test") 60 | print res 61 | 62 | 63 | except: 64 | line, filename, synerror = trace() 65 | print "error on line: %s" % line 66 | print "error in file name: %s" % filename 67 | print "with error message: %s" % synerror 68 | 69 | if __name__ == "__main__": 70 | main() -------------------------------------------------------------------------------- /samples/adds_rows_to_ags_service.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to add rows to an AGS based service 3 | version 3.5.4 4 | Python 2 5 | """ 6 | from __future__ import print_function 7 | from __future__ import absolute_import 8 | import arcrest 9 | from arcresthelper import featureservicetools 10 | from arcresthelper import common 11 | 12 | def trace(): 13 | """ 14 | trace finds the line, the filename 15 | and error message and returns it 16 | to the user 17 | """ 18 | import traceback, inspect,sys 19 | tb = sys.exc_info()[2] 20 | tbinfo = traceback.format_tb(tb)[0] 21 | filename = inspect.getfile(inspect.currentframe()) 22 | # script name + line number 23 | line = tbinfo.split(", ")[1] 24 | # Get Python syntax error 25 | # 26 | synerror = traceback.format_exc().splitlines()[-1] 27 | return line, filename, synerror 28 | 29 | def main(): 30 | proxy_port = None 31 | proxy_url = None 32 | 33 | securityinfo = {} 34 | securityinfo['security_type'] = 'AGS' 35 | securityinfo['username'] = ""# 36 | securityinfo['password'] = ""# 37 | securityinfo['org_url'] = ""# 34 | securityinfo['password'] = ""# 35 | securityinfo['org_url'] = "http://www.arcgis.com" 36 | securityinfo['proxy_url'] = proxy_url 37 | securityinfo['proxy_port'] = proxy_port 38 | securityinfo['referer_url'] = None 39 | securityinfo['token_url'] = None 40 | securityinfo['certificatefile'] = None 41 | securityinfo['keyfile'] = None 42 | securityinfo['client_id'] = None 43 | securityinfo['secret_id'] = None 44 | 45 | 46 | itemId = ""# 47 | 48 | layerName = "" #layer1 49 | pathToFeatureClass = r"" 50 | try: 51 | 52 | fst = featureservicetools.featureservicetools(securityinfo) 53 | if fst.valid == False: 54 | print fst.message 55 | else: 56 | 57 | fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) 58 | if not fs is None: 59 | 60 | fs_url = fst.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=True) 61 | if not fs_url is None: 62 | results = fst.AddFeaturesToFeatureLayer(url=fs_url, pathToFeatureClass=pathToFeatureClass, 63 | chunksize=2000) 64 | if 'addResults' in results: 65 | print "%s features processed" % len(results['addResults']) 66 | except (common.ArcRestHelperError),e: 67 | print "error in function: %s" % e[0]['function'] 68 | print "error on line: %s" % e[0]['line'] 69 | print "error in file name: %s" % e[0]['filename'] 70 | print "with error message: %s" % e[0]['synerror'] 71 | if 'arcpyError' in e[0]: 72 | print "with arcpy message: %s" % e[0]['arcpyError'] 73 | 74 | except: 75 | line, filename, synerror = trace() 76 | print "error on line: %s" % line 77 | print "error in file name: %s" % filename 78 | print "with error message: %s" % synerror 79 | 80 | if __name__ == "__main__": 81 | main() -------------------------------------------------------------------------------- /samples/append_fc_to_service.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to append a featureclass 3 | to a feature service using ArcRest and ArcRestHelper 4 | version 3.0.1 5 | Python 2 6 | """ 7 | import arcrest, json 8 | from arcresthelper import featureservicetools 9 | from arcresthelper import common 10 | def trace(): 11 | """ 12 | trace finds the line, the filename 13 | and error message and returns it 14 | to the user 15 | """ 16 | import traceback, inspect, sys 17 | tb = sys.exc_info()[2] 18 | tbinfo = traceback.format_tb(tb)[0] 19 | filename = inspect.getfile(inspect.currentframe()) 20 | # script name + line number 21 | line = tbinfo.split(", ")[1] 22 | # Get Python syntax error 23 | # 24 | synerror = traceback.format_exc().splitlines()[-1] 25 | return line, filename, synerror 26 | 27 | if __name__ == "__main__": 28 | 29 | proxy_port = None 30 | proxy_url = None 31 | 32 | securityinfo = {} 33 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 34 | securityinfo['username'] = ""# 35 | securityinfo['password'] = ""# 36 | securityinfo['org_url'] = "http://www.arcgis.com" 37 | securityinfo['proxy_url'] = proxy_url 38 | securityinfo['proxy_port'] = proxy_port 39 | securityinfo['referer_url'] = None 40 | securityinfo['token_url'] = None 41 | securityinfo['certificatefile'] = None 42 | securityinfo['keyfile'] = None 43 | securityinfo['client_id'] = None 44 | securityinfo['secret_id'] = None 45 | 46 | 47 | itemId = ""# 48 | layerName=''#Name of layer in the service 49 | fc=r''#Path to Feature Class 50 | atTable=None 51 | try: 52 | fst = featureservicetools.featureservicetools(securityinfo) 53 | if fst.valid == False: 54 | print fst.message 55 | else: 56 | 57 | fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) 58 | if not fs is None: 59 | 60 | fl = fst.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=False) 61 | if not fl is None: 62 | results = fl.addFeatures(fc=fc,attachmentTable=atTable) 63 | print json.dumps(results) 64 | else: 65 | print "Layer %s was not found, please check your credentials and layer name" % layerName 66 | else: 67 | print "Feature Service with id %s was not found" % fsId 68 | 69 | except: 70 | line, filename, synerror = trace() 71 | print "error on line: %s" % line 72 | print "error in file name: %s" % filename 73 | print "with error message: %s" % synerror -------------------------------------------------------------------------------- /samples/assign_credits_users.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows assign credits to a list 3 | of users 4 | 5 | """ 6 | from __future__ import print_function 7 | import arcrest 8 | 9 | def main(): 10 | username = "" 11 | password = "" 12 | proxy_url = "" 13 | proxy_port = "" 14 | org_url = "" 15 | sh = arcrest.AGOLTokenSecurityHandler(username=username, 16 | password=password, 17 | org_url=org_url, 18 | proxy_port=proxy_port, 19 | proxy_url=proxy_url) 20 | 21 | users = ["",""] # List of users 22 | credits = 2320 # number of credits to assign to users 23 | 24 | admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) 25 | portalself = admin.portals.portalSelf 26 | return portalself.assignUserCredits(usernames=users,credits=credits) 27 | 28 | if __name__ == "__main__": 29 | main() -------------------------------------------------------------------------------- /samples/change_folder.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | This sample shows how to loop through the folders 4 | and print their titles 5 | 6 | Python 2/3 7 | ArcREST version 3.5.x 8 | """ 9 | from __future__ import print_function 10 | from arcrest.security import AGOLTokenSecurityHandler 11 | import arcrest 12 | 13 | if __name__ == "__main__": 14 | username = ""#Username 15 | password = ""#password 16 | proxy_port = None 17 | proxy_url = None 18 | 19 | agolSH = AGOLTokenSecurityHandler(username=username, 20 | password=password) 21 | 22 | 23 | admin = arcrest.manageorg.Administration(securityHandler=agolSH) 24 | content = admin.content 25 | user = content.users.user() 26 | 27 | for folder in user.folders: 28 | title = folder['title'] 29 | print("Analyzing {}".format(title)) 30 | user.currentFolder = title 31 | print("Current folder is {}".format(user.currentFolder)) 32 | print("Current folder has {} items".format(len(user.items))) -------------------------------------------------------------------------------- /samples/create_groups_support_material.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/samples/create_groups_support_material.zip -------------------------------------------------------------------------------- /samples/create_replica_fs.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to create a replica from a FS 3 | 4 | ArcREST version 3.5.x 5 | Python 2/3 6 | 7 | """ 8 | from __future__ import print_function 9 | from arcrest.security import AGOLTokenSecurityHandler 10 | from arcrest.agol import FeatureService 11 | from arcrest.common.filters import LayerDefinitionFilter 12 | 13 | if __name__ == "__main__": 14 | username = "" 15 | password = "" 16 | url = "" 17 | proxy_port = None 18 | proxy_url = None 19 | agolSH = AGOLTokenSecurityHandler(username=username, 20 | password=password) 21 | fs = FeatureService( 22 | url=url, 23 | securityHandler=agolSH, 24 | proxy_port=proxy_port, 25 | proxy_url=proxy_url, 26 | initialize=True) 27 | result = fs.createReplica(replicaName='Demo', 28 | layers=[0,1,2,3], 29 | dataFormat="filegdb", 30 | out_path='C:\\temp') 31 | 32 | print( result) -------------------------------------------------------------------------------- /samples/create_replica_fs_attachments_unzip_rename.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to create a replica from a large FS with attachments. 3 | Download a zip file, unzip zip file, and rename output file gdb 4 | ArcREST version 3.5.x 5 | Python 2/3 6 | """ 7 | from __future__ import print_function 8 | from arcrest.security import AGOLTokenSecurityHandler 9 | from arcrest.agol import FeatureService 10 | from arcrest.common.filters import LayerDefinitionFilter 11 | import os, zipfile 12 | 13 | if __name__ == "__main__": 14 | username = "agol_username" 15 | password = "agol_password" 16 | url = "http://services1.arcgis.com/***/rest/services/yourservice/FeatureServer" 17 | proxy_port = None 18 | proxy_url = None 19 | agolSH = AGOLTokenSecurityHandler(username=username, password=password) 20 | repName = 'MyHostedFeatureLayerName' #Name of replica and unzipped file gdb 21 | filelocation = 'C:\\Temp' 22 | 23 | fs = FeatureService(url=url, 24 | securityHandler=agolSH, 25 | proxy_port=proxy_port, 26 | proxy_url=proxy_url, 27 | initialize=True) 28 | 29 | result = fs.createReplica(replicaName=repName, 30 | layers=[0,1,2,3,4,5,6,7,8], 31 | async=True, 32 | returnAttachments=True, 33 | returnAttachmentsDatabyURL=True, 34 | attachmentsSyncDirection='bidirectional', 35 | wait=True, 36 | dataFormat="filegdb", 37 | out_path=filelocation) 38 | 39 | dzipfile = '{0}'.format(result) 40 | parentdirectory = os.path.dirname(os.path.abspath(dzipfile)) 41 | newzip = zipfile.ZipFile(result) 42 | newzip.extractall(parentdirectory) 43 | z = zipfile.ZipFile(result, 'r') 44 | dirs = list(set([os.path.dirname(x) for x in z.namelist()])) 45 | extractedfgdb = '{0}'.format(os.path.join(parentdirectory,str(dirs[0]))) 46 | renamefgdb = '{0}\\{1}.gdb'.format(parentdirectory,repName) # Use repName or change to your choice of string value 47 | os.rename(extractedfgdb,renamefgdb) 48 | -------------------------------------------------------------------------------- /samples/create_replica_portal_item.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to create a 3 | replica from portal of a feature service. 4 | The replica is saved locally and on the 5 | portal in a .zip file. 6 | 7 | ArcREST version 3.0.1 8 | Python 2 9 | 10 | """ 11 | import arcrest 12 | from arcresthelper import securityhandlerhelper 13 | from arcresthelper import common 14 | 15 | def trace(): 16 | """ 17 | trace finds the line, the filename 18 | and error message and returns it 19 | to the user 20 | """ 21 | import traceback, inspect, sys 22 | tb = sys.exc_info()[2] 23 | tbinfo = traceback.format_tb(tb)[0] 24 | filename = inspect.getfile(inspect.currentframe()) 25 | # script name + line number 26 | line = tbinfo.split(", ")[1] 27 | # Get Python syntax error 28 | # 29 | synerror = traceback.format_exc().splitlines()[-1] 30 | return line, filename, synerror 31 | 32 | if __name__ == "__main__": 33 | proxy_port = None 34 | proxy_url = None 35 | 36 | securityinfo = {} 37 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 38 | securityinfo['username'] = ""# 39 | securityinfo['password'] = ""# 40 | securityinfo['org_url'] = "http://www.arcgis.com" 41 | securityinfo['proxy_url'] = proxy_url 42 | securityinfo['proxy_port'] = proxy_port 43 | securityinfo['referer_url'] = None 44 | securityinfo['token_url'] = None 45 | securityinfo['certificatefile'] = None 46 | securityinfo['keyfile'] = None 47 | securityinfo['client_id'] = None 48 | securityinfo['secret_id'] = None 49 | 50 | itemId = ""# 51 | savePath = r"c:\temp"# 52 | try: 53 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) 54 | if shh.valid == False: 55 | print shh.message 56 | else: 57 | admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) 58 | 59 | item = admin.content.getItem(itemId) 60 | user = admin.content.users.user(username=item.owner) 61 | 62 | exportParameters = {"layers":[ 63 | { 64 | "id": 0, 65 | "where": "OBJECTID = 1" 66 | }] 67 | } 68 | res = user.exportItem(title="TestExport", 69 | itemId=itemId, 70 | exportFormat="File Geodatabase", 71 | exportParameters=exportParameters, 72 | wait=True) 73 | exportItemId = res.id 74 | exportItem = admin.content.getItem(exportItemId) 75 | itemDataPath = exportItem.itemData(f=None, savePath=savePath) 76 | print exportItem.userItem.deleteItem() 77 | 78 | print itemDataPath 79 | except (common.ArcRestHelperError),e: 80 | print "error in function: %s" % e[0]['function'] 81 | print "error on line: %s" % e[0]['line'] 82 | print "error in file name: %s" % e[0]['filename'] 83 | print "with error message: %s" % e[0]['synerror'] 84 | if 'arcpyError' in e[0]: 85 | print "with arcpy message: %s" % e[0]['arcpyError'] 86 | 87 | except: 88 | line, filename, synerror = trace() 89 | print "error on line: %s" % line 90 | print "error in file name: %s" % filename 91 | print "with error message: %s" % synerror 92 | -------------------------------------------------------------------------------- /samples/delete_rows_from_service.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to delete rows from a layer 3 | ArcREST version 3.0.1 4 | Python 2 5 | """ 6 | import arcrest 7 | from arcresthelper import featureservicetools 8 | from arcresthelper import common 9 | 10 | def trace(): 11 | """ 12 | trace finds the line, the filename 13 | and error message and returns it 14 | to the user 15 | """ 16 | import traceback, inspect, sys 17 | tb = sys.exc_info()[2] 18 | tbinfo = traceback.format_tb(tb)[0] 19 | filename = inspect.getfile(inspect.currentframe()) 20 | # script name + line number 21 | line = tbinfo.split(", ")[1] 22 | # Get Python syntax error 23 | # 24 | synerror = traceback.format_exc().splitlines()[-1] 25 | return line, filename, synerror 26 | 27 | def main(): 28 | proxy_port = None 29 | proxy_url = None 30 | 31 | securityinfo = {} 32 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 33 | securityinfo['username'] = ""# 34 | securityinfo['password'] = ""# 35 | securityinfo['org_url'] = "http://www.arcgis.com" 36 | securityinfo['proxy_url'] = proxy_url 37 | securityinfo['proxy_port'] = proxy_port 38 | securityinfo['referer_url'] = None 39 | securityinfo['token_url'] = None 40 | securityinfo['certificatefile'] = None 41 | securityinfo['keyfile'] = None 42 | securityinfo['client_id'] = None 43 | securityinfo['secret_id'] = None 44 | 45 | 46 | itemId = ""# 47 | sql = "1=1" 48 | layerNames = "layer1, layer2" #layer1, layer2 49 | try: 50 | 51 | fst = featureservicetools.featureservicetools(securityinfo) 52 | if fst.valid == False: 53 | print fst.message 54 | else: 55 | 56 | fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) 57 | if not fs is None: 58 | 59 | for layerName in layerNames.split(','): 60 | fs_url = fst.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=True) 61 | if not fs_url is None: 62 | print fst.DeleteFeaturesFromFeatureLayer(url=fs_url, sql=sql, 63 | chunksize=2000) 64 | except (common.ArcRestHelperError),e: 65 | print "error in function: %s" % e[0]['function'] 66 | print "error on line: %s" % e[0]['line'] 67 | print "error in file name: %s" % e[0]['filename'] 68 | print "with error message: %s" % e[0]['synerror'] 69 | if 'arcpyError' in e[0]: 70 | print "with arcpy message: %s" % e[0]['arcpyError'] 71 | 72 | except: 73 | line, filename, synerror = trace() 74 | print "error on line: %s" % line 75 | print "error in file name: %s" % filename 76 | print "with error message: %s" % synerror 77 | 78 | if __name__ == "__main__": 79 | main() -------------------------------------------------------------------------------- /samples/disable_sync_service.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to disable 3 | sync on a feature service 4 | CSV requires the following fields 5 | - itemid - ID of AGOL item 6 | 7 | 8 | 9 | """ 10 | import arcrest 11 | from arcrest.security import AGOLTokenSecurityHandler 12 | from arcrest.security import PortalTokenSecurityHandler 13 | 14 | import os, datetime 15 | import csv 16 | import arcresthelper 17 | from arcresthelper import featureservicetools 18 | from arcresthelper import common as Common 19 | 20 | dateTimeFormat = '%Y-%m-%d %H:%M' 21 | 22 | def trace(): 23 | """ 24 | trace finds the line, the filename 25 | and error message and returns it 26 | to the user 27 | """ 28 | import traceback, inspect, sys 29 | tb = sys.exc_info()[2] 30 | tbinfo = traceback.format_tb(tb)[0] 31 | filename = inspect.getfile(inspect.currentframe()) 32 | # script name + line number 33 | line = tbinfo.split(", ")[1] 34 | # Get Python syntax error 35 | # 36 | synerror = traceback.format_exc().splitlines()[-1] 37 | return line, filename, synerror 38 | 39 | def main(): 40 | securityinfo = {} 41 | securityinfo['security_type'] = 'Portal' 42 | securityinfo['username'] = "" 43 | securityinfo['password'] = "" 44 | securityinfo['org_url'] = "http://www.arcgis.com" 45 | 46 | itemCSVFile = r'' 47 | 48 | sciptPath = os.getcwd() 49 | try: 50 | print "###############Script Started#################" 51 | print datetime.datetime.now().strftime(dateTimeFormat) 52 | if os.path.exists(itemCSVFile) == False: 53 | itemCSVFile = os.path.join(sciptPath,itemCSVFile) 54 | elif os.path.isabs(itemCSVFile) == False: 55 | itemCSVFile = os.path.join(sciptPath,itemCSVFile) 56 | if os.path.exists(itemCSVFile) == False: 57 | print "CSV %s could not be located" % itemCSVFile 58 | return 59 | if os.path.isfile(itemCSVFile) == False: 60 | print "csv file %s could not be located" % itemCSVFile 61 | return 62 | 63 | fst = featureservicetools.featureservicetools(securityinfo=securityinfo) 64 | if fst.valid: 65 | with open(itemCSVFile, 'rb') as csvfile: 66 | 67 | for row in csv.DictReader(csvfile,dialect='excel'): 68 | 69 | if not 'itemid' in row: 70 | print "itemID could not be found if table" 71 | return 72 | itemid = row['itemid'] 73 | fs = fst.GetFeatureService(itemId=itemid,returnURLOnly=False) 74 | print fst.disableSync(url=fs.url) 75 | else: 76 | print "Error: %s" % fst.message 77 | 78 | except: 79 | line, filename, synerror = trace() 80 | print "error on line: %s" % line) 81 | print "error in file name: %s" % filename 82 | print "with error message: %s" % synerror 83 | 84 | finally: 85 | print datetime.datetime.now().strftime(dateTimeFormat) 86 | print "###############Script Completed#################" 87 | 88 | if __name__ == "__main__": 89 | main() -------------------------------------------------------------------------------- /samples/disable_sync_service_item.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to disable 3 | sync on a feature service 4 | CSV requires the following fields 5 | - itemid - ID of AGOL item 6 | 7 | 8 | 9 | """ 10 | from __future__ import print_function 11 | import arcrest 12 | from arcrest.security import AGOLTokenSecurityHandler 13 | from arcrest.security import PortalTokenSecurityHandler 14 | 15 | import os, datetime 16 | import csv 17 | import arcresthelper 18 | from arcresthelper import featureservicetools 19 | from arcresthelper import common as Common 20 | 21 | dateTimeFormat = '%Y-%m-%d %H:%M' 22 | 23 | def trace(): 24 | """ 25 | trace finds the line, the filename 26 | and error message and returns it 27 | to the user 28 | """ 29 | import traceback, inspect, sys 30 | tb = sys.exc_info()[2] 31 | tbinfo = traceback.format_tb(tb)[0] 32 | filename = inspect.getfile(inspect.currentframe()) 33 | # script name + line number 34 | line = tbinfo.split(", ")[1] 35 | # Get Python syntax error 36 | # 37 | synerror = traceback.format_exc().splitlines()[-1] 38 | return line, filename, synerror 39 | 40 | def main(): 41 | securityinfo = {} 42 | securityinfo['security_type'] = 'Portal' 43 | securityinfo['username'] = "" 44 | securityinfo['password'] = "" 45 | securityinfo['org_url'] = "http://www.arcgis.com" 46 | try: 47 | fst = featureservicetools.featureservicetools(securityinfo=securityinfo) 48 | fs = fst.GetFeatureService(itemId='',returnURLOnly=False) 49 | result = fst.disableSync(url=fs.url) 50 | print (result) 51 | 52 | 53 | except: 54 | line, filename, synerror = trace() 55 | print ("error on line: %s" % line) 56 | print ("error in file name: %s" % filename) 57 | print ("with error message: %s" % synerror) 58 | 59 | finally: 60 | print (datetime.datetime.now().strftime(dateTimeFormat)) 61 | print ("###############Script Completed#################") 62 | 63 | if __name__ == "__main__": 64 | main() -------------------------------------------------------------------------------- /samples/enableEsriAccess.py: -------------------------------------------------------------------------------- 1 | from arcresthelper import securityhandlerhelper 2 | from arcrest.security import AGOLTokenSecurityHandler 3 | import arcrest 4 | 5 | if __name__ == "__main__": 6 | 7 | proxy_port = None 8 | proxy_url = None 9 | 10 | securityinfo = {} 11 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI, ArcGIS 12 | securityinfo['username'] = '' #User Name 13 | securityinfo['password'] = '' #password 14 | securityinfo['org_url'] = 'https://www.arcgis.com' 15 | securityinfo['proxy_url'] = proxy_url 16 | securityinfo['proxy_port'] = proxy_port 17 | securityinfo['referer_url'] = None 18 | securityinfo['token_url'] = None 19 | securityinfo['certificatefile'] = None 20 | securityinfo['keyfile'] = None 21 | securityinfo['client_id'] = None 22 | securityinfo['secret_id'] = None 23 | 24 | enableAccess = True #False disables access, True enables access 25 | usersToSkip = ["scottmooremsl"] #users to skip enabling or disabling. use all lowercase usernames like "username1", comma separated in double quotes 26 | 27 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) 28 | if shh.valid == False: 29 | print (shh.message) 30 | else: 31 | admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler, initialize=True) 32 | portal = admin.portals.portalSelf 33 | ns = 1 34 | while (ns > -1): 35 | commUsers = portal.users(start=ns, num=100) 36 | ns = commUsers['nextStart'] 37 | commUsers = commUsers['users'] 38 | for commUser in commUsers: 39 | if not commUser.username.lower() in usersToSkip: 40 | user = admin.community.users.user(commUser.username) 41 | print commUser.username + ": " + commUser.userType + " {" + commUser.provider + ")" 42 | if (enableAccess == True): 43 | if commUser.userType == 'arcgisonly': 44 | print (user.update(userType='both')) 45 | print (commUser.username + ": enabling Esri Access") 46 | else: 47 | print (commUser.username + ": Esri Access already enabled") 48 | 49 | else: 50 | if commUser.userType == 'both': 51 | print (user.update(userType='arcgisonly')) 52 | print (commUser.username + ": disabling Esri Access") 53 | else: 54 | print (commUser.username + ": Esri Access already disabled") 55 | else: 56 | print (commUser.username + ": skipped") 57 | 58 | -------------------------------------------------------------------------------- /samples/generate_portal_server_token.py: -------------------------------------------------------------------------------- 1 | """ 2 | This show is used to test the generation 3 | of a portal and server token 4 | 5 | Python 2/3 6 | ArcREST version 3.5.0 7 | 8 | """ 9 | from __future__ import print_function 10 | import arcrest 11 | 12 | def trace(): 13 | """ 14 | trace finds the line, the filename 15 | and error message and returns it 16 | to the user 17 | """ 18 | import traceback, inspect, sys 19 | tb = sys.exc_info()[2] 20 | tbinfo = traceback.format_tb(tb)[0] 21 | filename = inspect.getfile(inspect.currentframe()) 22 | # script name + line number 23 | line = tbinfo.split(", ")[1] 24 | # Get Python syntax error 25 | # 26 | synerror = traceback.format_exc().splitlines()[-1] 27 | return line, filename, synerror 28 | 29 | if __name__ == "__main__": 30 | 31 | username = "" 32 | password = "" 33 | url = "www.arcgis.com" 34 | try: 35 | sh = arcrest.PortalTokenSecurityHandler(username=username, password=password, org_url=url) 36 | admin = arcrest.manageorg.Administration(url=url, 37 | securityHandler=sh) 38 | 39 | hostingServers = admin.hostingServers() 40 | for server in hostingServers: 41 | print( server.currentVersion) 42 | except: 43 | line, filename, synerror = trace() 44 | print "error on line: %s" % line 45 | print "error in file name: %s" % filename 46 | print "with error message: %s" % synerror -------------------------------------------------------------------------------- /samples/loop_users_items.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to loop through all users and their 3 | items 4 | 5 | Python 2/3 6 | ArcREST version 3.5.x 7 | """ 8 | from __future__ import print_function 9 | import arcrest 10 | from arcrest.security import AGOLTokenSecurityHandler 11 | from datetime import datetime as dt 12 | import numpy as np 13 | 14 | datetimeformat = '%m/%d/%Y %H:%M:%S' 15 | createUsage = True # to filter views by date 16 | 17 | # Start & end times to aggregate between 18 | start = dt(2015, 7, 1) 19 | end = dt(2015, 9, 1) 20 | # Change period to different value (1w, 1m, etc.) for larger date ranges. 21 | params = { 22 | "period": "1d", 23 | "groupby": "name", 24 | "vars": "num", 25 | "etype": "svcusg", 26 | "stype": "portal", 27 | } 28 | 29 | if __name__ == "__main__": 30 | username = ""#Username 31 | password = ""#password 32 | proxy_port = None 33 | proxy_url = None 34 | 35 | agolSH = AGOLTokenSecurityHandler(username=username, 36 | password=password) 37 | 38 | 39 | admin = arcrest.manageorg.Administration(securityHandler=agolSH) 40 | content = admin.content 41 | portal = admin.portals.portalSelf 42 | commUsers = portal.users(start=1, num=100) 43 | commUsers = commUsers['users'] 44 | 45 | for commUser in commUsers: 46 | user = admin.content.users.user(commUser.username) 47 | for userItem in user.items: 48 | 49 | msg = "Item: {0}".format(userItem.id) 50 | msg = msg + "\n\tName: {0}".format(userItem.name) 51 | msg = msg + "\n\tTitle: {0}".format(userItem.title) 52 | msg = msg + "\n\tType: {0}".format(userItem.type) 53 | msg = msg + "\n\tOwned by: {0}".format(commUser.username) 54 | msg = msg + "\n\tCreated on: {0}".format(arcrest.general.online_time_to_string(userItem.created,datetimeformat)) 55 | msg = msg + "\n\tLast modified on: {0}".format(arcrest.general.online_time_to_string(userItem.modified,datetimeformat)) 56 | msg = msg + "\n\tTotal Views: {0}".format(userItem.numViews) 57 | 58 | if createUsage: 59 | params['name'] = userItem.id 60 | usage = portal.usage(start, end, **params) 61 | views = 0 62 | 63 | if usage.get('error', None) is None: 64 | for data in usage.get('data', []): 65 | # Views per period are returned as a list of lists 66 | # Import to numpy for easy summing 67 | arr = np.array(data['num'], dtype=np.uint64) 68 | views = arr.sum(0)[1] # Sum "2nd column" 69 | # Alternatively, without numpy 70 | # views = sum(map(int, zip(*data['num'])[1])) 71 | else: 72 | print(usage['error']) 73 | 74 | msg = msg + "\n\tTimestamped Views: {0}".format(views) 75 | 76 | msg = msg + "\n----------------------------------------------------------" 77 | print (msg) 78 | 79 | -------------------------------------------------------------------------------- /samples/publish_sd_to_service.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to publish and 3 | Item to AGOL/Portal as a Hosted Feature Service. 4 | 5 | It assumes you have ALREADY added the item to the site. 6 | 7 | Python 2/3 8 | ArcREST 3.5.0 9 | 10 | """ 11 | from __future__ import print_function 12 | import arcrest 13 | 14 | if __name__ == "__main__": 15 | # Inputs 16 | # 17 | username = "" 18 | password = "" 19 | url = "" #URL to ArcGIS Online or your portal 20 | itemId = "" # item id of SD file 21 | itemFolder = None # If you item is in a folder, you need to specify its name here 22 | tags = "Demo, Publishing" 23 | siteType = "AGOL" # can be AGOL or PORTAL 24 | # Logic 25 | # 26 | if siteType == "AGOL": 27 | securityHandler = arcrest.AGOLTokenSecurityHandler(username, 28 | password) 29 | admin = arcrest.manageorg.Administration(securityHandler=securityHandler) 30 | else: 31 | securityHandler = arcrest.PortalTokenSecurityHandler(username, password, org_url=url) 32 | admin = arcrest.manageorg.Administration(url=url, securityHandler=securityHandler) 33 | # Access the User to gain access the the publishItem() 34 | # 35 | content = admin.content 36 | users = content.users 37 | user = users.user(username=username) 38 | if itemFolder is not None: 39 | user.currentFolder = itemFolder 40 | # Provide the Publish parameters 41 | # 42 | publishParameters = arcrest.manageorg.PublishSDParameters(tags=tags) 43 | # Publish the service to the site 44 | # 45 | print (user.publishItem( 46 | fileType="serviceDefinition", 47 | itemId=itemId, 48 | publishParameters=publishParameters)) 49 | 50 | #a UserItem is a valid return object -------------------------------------------------------------------------------- /samples/publishingGeoJSON.py: -------------------------------------------------------------------------------- 1 | """ 2 | GeoJSON example using addItem 3 | 4 | Python 2/3 5 | ArcREST version 3.5.0 6 | """ 7 | from __future__ import print_function 8 | import arcrest 9 | 10 | if __name__ == "__main__": 11 | username = "" 12 | password = "" 13 | geojsonFile = r"" 14 | sh = arcrest.AGOLTokenSecurityHandler(username, password) 15 | admin = arcrest.manageorg.Administration(securityHandler=sh) 16 | user = admin.content.users.user() 17 | ip = arcrest.manageorg.ItemParameter() 18 | ip.title = "MyGeoJSONTestFile" 19 | ip.type = "GeoJson" 20 | ip.tags = "Geo1,Geo2" 21 | ip.description = "Publishing a geojson file" 22 | addedItem = user.addItem(itemParameters=ip, filePath=geojsonFile) 23 | itemId = addedItem.id 24 | pp = arcrest.manageorg.PublishGeoJSONParameter() 25 | pp.name = "Geojsonrocks" 26 | pp.hasStaticData = True 27 | print( user.publishItem(fileType="geojson", publishParameters=pp, itemId=itemId, wait=True)) -------------------------------------------------------------------------------- /samples/query_agol_layer.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from arcrest.security import AGOLTokenSecurityHandler 3 | from arcrest.agol import FeatureLayer 4 | 5 | if __name__ == "__main__": 6 | username = "" 7 | password = "" 8 | url = "" 9 | proxy_port = None 10 | proxy_url = None 11 | 12 | agolSH = AGOLTokenSecurityHandler(username=username, 13 | password=password) 14 | 15 | fl = FeatureLayer( 16 | url=url, 17 | securityHandler=agolSH, 18 | proxy_port=proxy_port, 19 | proxy_url=proxy_url, 20 | initialize=True) 21 | 22 | print (fl.query(where="1=1",out_fields='*',returnGeometry=False) ) 23 | -------------------------------------------------------------------------------- /samples/query_agol_layer_using_ArcMap_Creds.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | @author: ArcREST Team 4 | @contact: www.github.com/Esri/ArcREST 5 | @company: Esri 6 | @version: 1.0.0 7 | @description: Querys a layer using ArcMap Creds. 8 | @requirements: Python 2.7.x, ArcGIS 10.3, ArcREST 3.5.0 9 | @copyright: Esri, 2015 10 | """ 11 | import os 12 | from arcpy import env 13 | from arcpy import mapping 14 | from arcpy import da 15 | import arcpy 16 | import arcrest 17 | from arcrest.security import ArcGISTokenSecurityHandler 18 | from arcrest.agol import FeatureLayer 19 | 20 | #-------------------------------------------------------------------------- 21 | class FunctionError(Exception): 22 | """ raised when a function fails to run """ 23 | pass 24 | #-------------------------------------------------------------------------- 25 | def trace(): 26 | """ 27 | trace finds the line, the filename 28 | and error message and returns it 29 | to the user 30 | """ 31 | import traceback 32 | import sys 33 | tb = sys.exc_info()[2] 34 | tbinfo = traceback.format_tb(tb)[0] 35 | # script name + line number 36 | line = tbinfo.split(", ")[1] 37 | # Get Python syntax error 38 | # 39 | synerror = traceback.format_exc().splitlines()[-1] 40 | return line, __file__, synerror 41 | 42 | #-------------------------------------------------------------------------- 43 | def main(*argv): 44 | """ main driver of program """ 45 | try: 46 | url = str(argv[0]) 47 | 48 | arcgisSH = ArcGISTokenSecurityHandler() 49 | if arcgisSH.valid == False: 50 | arcpy.AddError(arcgisSH.message) 51 | return 52 | fl = FeatureLayer( 53 | url=url, 54 | securityHandler=arcgisSH, 55 | initialize=True) 56 | 57 | res = fl.query(where="1=1",out_fields='*',returnGeometry=False) 58 | arcpy.AddMessage(res) 59 | arcpy.SetParameterAsText(1, str(res)) 60 | except arcpy.ExecuteError: 61 | line, filename, synerror = trace() 62 | arcpy.AddError("error on line: %s" % line) 63 | arcpy.AddError("error in file name: %s" % filename) 64 | arcpy.AddError("with error message: %s" % synerror) 65 | arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) 66 | except FunctionError, f_e: 67 | messages = f_e.args[0] 68 | arcpy.AddError("error in function: %s" % messages["function"]) 69 | arcpy.AddError("error on line: %s" % messages["line"]) 70 | arcpy.AddError("error in file name: %s" % messages["filename"]) 71 | arcpy.AddError("with error message: %s" % messages["synerror"]) 72 | arcpy.AddError("ArcPy Error Message: %s" % messages["arc"]) 73 | except: 74 | line, filename, synerror = trace() 75 | arcpy.AddError("error on line: %s" % line) 76 | arcpy.AddError("error in file name: %s" % filename) 77 | arcpy.AddError("with error message: %s" % synerror) 78 | #-------------------------------------------------------------------------- 79 | if __name__ == "__main__": 80 | env.overwriteOutput = True 81 | argv = tuple(arcpy.GetParameterAsText(i) 82 | for i in xrange(arcpy.GetArgumentCount())) 83 | main(*argv) -------------------------------------------------------------------------------- /samples/query_agol_service.py: -------------------------------------------------------------------------------- 1 | """ 2 | Query agol service 3 | Python 2.x 4 | ArcREST 3.0.1 5 | """ 6 | 7 | from __future__ import print_function 8 | from arcresthelper import securityhandlerhelper 9 | from arcrest.agol import FeatureService 10 | from arcrest.common.filters import LayerDefinitionFilter 11 | 12 | if __name__ == "__main__": 13 | url = '' 14 | proxy_port = None 15 | proxy_url = None 16 | 17 | securityinfo = {} 18 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 19 | securityinfo['username'] = "" 20 | securityinfo['password'] = "" 21 | securityinfo['org_url'] = "http://www.arcgis.com" 22 | securityinfo['proxy_url'] = proxy_url 23 | securityinfo['proxy_port'] = proxy_port 24 | securityinfo['referer_url'] = None 25 | securityinfo['token_url'] = None 26 | securityinfo['certificatefile'] = None 27 | securityinfo['keyfile'] = None 28 | securityinfo['client_id'] = None 29 | securityinfo['secret_id'] = None 30 | 31 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) 32 | if shh.valid == False: 33 | print (shh.message) 34 | else: 35 | fs = FeatureService( 36 | url=url, 37 | securityHandler=shh.securityhandler, 38 | proxy_port=proxy_port, 39 | proxy_url=proxy_url, 40 | initialize=True) 41 | ldf = LayerDefinitionFilter() 42 | ldf.addFilter(0, where="1=1") 43 | print (fs.query(layerDefsFilter=ldf, 44 | returnCountOnly=True)) 45 | # should see something like : {'layers': [{'count': 4, 'id': 0}]} -------------------------------------------------------------------------------- /samples/query_rows_from_service.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to query large amount of rows 3 | from a layer 4 | 5 | Python 2.x 6 | ArcREST 3.0.1 7 | """ 8 | import arcrest 9 | from arcresthelper import featureservicetools 10 | from arcresthelper import common 11 | 12 | def trace(): 13 | """ 14 | trace finds the line, the filename 15 | and error message and returns it 16 | to the user 17 | """ 18 | import traceback, inspect, sys 19 | tb = sys.exc_info()[2] 20 | tbinfo = traceback.format_tb(tb)[0] 21 | filename = inspect.getfile(inspect.currentframe()) 22 | # script name + line number 23 | line = tbinfo.split(", ")[1] 24 | # Get Python syntax error 25 | # 26 | synerror = traceback.format_exc().splitlines()[-1] 27 | return line, filename, synerror 28 | 29 | def main(): 30 | proxy_port = None 31 | proxy_url = None 32 | 33 | securityinfo = {} 34 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 35 | securityinfo['username'] = ""# 36 | securityinfo['password'] = ""# 37 | securityinfo['org_url'] = "http://www.arcgis.com"#Specify your organization's arcgis.com url 38 | securityinfo['proxy_url'] = proxy_url 39 | securityinfo['proxy_port'] = proxy_port 40 | securityinfo['referer_url'] = None 41 | securityinfo['token_url'] = None 42 | securityinfo['certificatefile'] = None 43 | securityinfo['keyfile'] = None 44 | securityinfo['client_id'] = None 45 | securityinfo['secret_id'] = None 46 | 47 | 48 | itemId = ""# 49 | layerNames = "" #layer1, layer2 50 | try: 51 | 52 | fst = featureservicetools.featureservicetools(securityinfo) 53 | if fst.valid == False: 54 | print fst.message 55 | else: 56 | 57 | fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) 58 | if not fs is None: 59 | 60 | for layerName in layerNames.split(','): 61 | fs_url = fst.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=True) 62 | if not fs_url is None: 63 | print fst.QueryAllFeatures(url=fs_url, 64 | chunksize=300, 65 | returnFeatureClass=True, 66 | out_fc="C:/temp/test.shp") 67 | except (common.ArcRestHelperError),e: 68 | print "error in function: %s" % e[0]['function'] 69 | print "error on line: %s" % e[0]['line'] 70 | print "error in file name: %s" % e[0]['filename'] 71 | print "with error message: %s" % e[0]['synerror'] 72 | if 'arcpyError' in e[0]: 73 | print "with arcpy message: %s" % e[0]['arcpyError'] 74 | 75 | except: 76 | line, filename, synerror = trace() 77 | print "error on line: %s" % line 78 | print "error in file name: %s" % filename 79 | print "with error message: %s" % synerror 80 | 81 | if __name__ == "__main__": 82 | main() 83 | -------------------------------------------------------------------------------- /samples/readme.txt: -------------------------------------------------------------------------------- 1 | All ArcREST Sample Code Goes in This Section. 2 | 3 | To request a sample for a specific set of code, please log it in the 'Issues' section of github. 4 | -------------------------------------------------------------------------------- /samples/remove_adds_rows_to_service.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to delete rows from a layer 3 | 4 | Python 2.x 5 | ArcREST 3.0.1 6 | """ 7 | import arcrest 8 | from arcresthelper import featureservicetools 9 | from arcresthelper import common 10 | import datetime 11 | 12 | def trace(): 13 | """ 14 | trace finds the line, the filename 15 | and error message and returns it 16 | to the user 17 | """ 18 | import traceback, inspect, sys 19 | tb = sys.exc_info()[2] 20 | tbinfo = traceback.format_tb(tb)[0] 21 | filename = inspect.getfile(inspect.currentframe()) 22 | # script name + line number 23 | line = tbinfo.split(", ")[1] 24 | # Get Python syntax error 25 | # 26 | synerror = traceback.format_exc().splitlines()[-1] 27 | return line, filename, synerror 28 | 29 | def main(): 30 | proxy_port = None 31 | proxy_url = None 32 | 33 | securityinfo = {} 34 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 35 | securityinfo['username'] = ""# 36 | securityinfo['password'] = ""# 37 | securityinfo['org_url'] = "http://www.arcgis.com" 38 | securityinfo['proxy_url'] = proxy_url 39 | securityinfo['proxy_port'] = proxy_port 40 | securityinfo['referer_url'] = None 41 | securityinfo['token_url'] = None 42 | securityinfo['certificatefile'] = None 43 | securityinfo['keyfile'] = None 44 | securityinfo['client_id'] = None 45 | securityinfo['secret_id'] = None 46 | 47 | 48 | itemId = ""# 49 | 50 | layerName = "" #layer1 51 | id_field ='PARCELID' # ID Field 52 | 53 | pathToFeatureClass = r""#Path to FC 54 | try: 55 | startTime = datetime.datetime.now() 56 | print "Starting process at %s" % (configFile,startTime.strftime(dateTimeFormat)) 57 | 58 | fst = featureservicetools.featureservicetools(securityinfo) 59 | if fst.valid == False: 60 | print fst.message 61 | else: 62 | 63 | fs = fst.GetFeatureService(itemId=itemId,returnURLOnly=False) 64 | if not fs is None: 65 | 66 | fs_url = fst.GetLayerFromFeatureService(fs=fs,layerName=layerName,returnURLOnly=True) 67 | if not fs_url is None: 68 | results = fst.RemoveAndAddFeatures(url=fs_url, 69 | pathToFeatureClass=pathToFeatureClass, 70 | id_field=id_field, 71 | chunksize=50) 72 | 73 | print "process completed in %s" % (configFile, str(datetime.datetime.now() - startTime)) 74 | except (common.ArcRestHelperError),e: 75 | print "error in function: %s" % e[0]['function'] 76 | print "error on line: %s" % e[0]['line'] 77 | print "error in file name: %s" % e[0]['filename'] 78 | print "with error message: %s" % e[0]['synerror'] 79 | if 'arcpyError' in e[0]: 80 | print "with arcpy message: %s" % e[0]['arcpyError'] 81 | 82 | except: 83 | line, filename, synerror = trace() 84 | print "error on line: %s" % line 85 | print "error in file name: %s" % filename 86 | print "with error message: %s" % synerror 87 | 88 | if __name__ == "__main__": 89 | main() -------------------------------------------------------------------------------- /samples/remove_all_content_groups_allusers.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to loop through all users 3 | and delete all their content and groups 4 | 5 | Python 2.x 6 | ArcREST 3.5 7 | """ 8 | from __future__ import print_function 9 | import arcrest 10 | from arcresthelper import resettools 11 | from arcresthelper import common 12 | def trace(): 13 | """ 14 | trace finds the line, the filename 15 | and error message and returns it 16 | to the user 17 | """ 18 | import traceback, inspect, sys 19 | tb = sys.exc_info()[2] 20 | tbinfo = traceback.format_tb(tb)[0] 21 | filename = inspect.getfile(inspect.currentframe()) 22 | # script name + line number 23 | line = tbinfo.split(", ")[1] 24 | # Get Python syntax error 25 | # 26 | synerror = traceback.format_exc().splitlines()[-1] 27 | return line, filename, synerror 28 | 29 | def main(): 30 | proxy_port = None 31 | proxy_url = None 32 | 33 | securityinfo = {} 34 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 35 | securityinfo['username'] = ""#Username 36 | securityinfo['password'] = ""#Password 37 | securityinfo['org_url'] = "http://www.arcgis.com" 38 | securityinfo['proxy_url'] = proxy_url 39 | securityinfo['proxy_port'] = proxy_port 40 | securityinfo['referer_url'] = None 41 | securityinfo['token_url'] = None 42 | securityinfo['certificatefile'] = None 43 | securityinfo['keyfile'] = None 44 | securityinfo['client_id'] = None 45 | securityinfo['secret_id'] = None 46 | 47 | try: 48 | 49 | rst = resettools.resetTools(securityinfo=securityinfo) 50 | if rst.valid: 51 | 52 | users = rst.securityhandler.username# comma delimited list of users ex: 'User1, User2' 53 | 54 | rst.removeUserData(users=users) 55 | rst.removeUserGroups(users=users) 56 | else: 57 | print (rst.message) 58 | except (common.ArcRestHelperError) as e: 59 | print ("error in function: %s" % e[0]['function']) 60 | print ("error on line: %s" % e[0]['line']) 61 | print ("error in file name: %s" % e[0]['filename']) 62 | print ("with error message: %s" % e[0]['synerror']) 63 | if 'arcpyError' in e[0]: 64 | print ("with arcpy message: %s" % e[0]['arcpyError']) 65 | except: 66 | line, filename, synerror = trace() 67 | print ("error on line: %s" % line) 68 | print ("error in file name: %s" % filename) 69 | print ("with error message: %s" % synerror) 70 | 71 | if __name__ == "__main__": 72 | main() 73 | -------------------------------------------------------------------------------- /samples/toggleEditing.py: -------------------------------------------------------------------------------- 1 | """ 2 | Toggle editting script 3 | 4 | Python 2.x 5 | ArcREST 3.0.1 6 | """ 7 | from arcresthelper import securityhandlerhelper 8 | from arcresthelper import featureservicetools 9 | import os 10 | 11 | if __name__ == "__main__": 12 | 13 | proxy_port = None 14 | proxy_url = None 15 | 16 | securityinfo = {} 17 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI, ArcGIS 18 | securityinfo['username'] = '' 19 | securityinfo['password'] = '' 20 | securityinfo['org_url'] = "https://www.arcgis.com" 21 | 22 | serviceUrl = ''#URL to service, make sure to not include a layer 23 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) 24 | if shh.valid == False: 25 | print shh.message 26 | else: 27 | fst = featureservicetools.featureservicetools(securityinfo=securityinfo) 28 | if fst.valid: 29 | print fst.EnableEditingOnService(url=serviceUrl) -------------------------------------------------------------------------------- /samples/update_features.py: -------------------------------------------------------------------------------- 1 | """ 2 | Update a feature service 3 | 4 | Python 2.x 5 | ArcREST 3.0.1 6 | """ 7 | from arcresthelper import securityhandlerhelper 8 | from arcrest.agol import FeatureLayer 9 | from arcrest.common.filters import LayerDefinitionFilter 10 | import datetime 11 | from datetime import timedelta 12 | from arcrest.common.general import local_time_to_online,online_time_to_string 13 | 14 | if __name__ == "__main__": 15 | url = ''# URL to Service 16 | sql = ''# where clause 17 | 18 | dt = local_time_to_online(datetime.datetime.now()) 19 | 20 | fieldInfo =[ 21 | { 22 | 'FieldName':'NAME', 23 | 'ValueToSet':'test' 24 | } 25 | ] 26 | 27 | proxy_port = None 28 | proxy_url = None 29 | 30 | securityinfo = {} 31 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI, ArcGIS 32 | securityinfo['username'] = "" #User Name 33 | securityinfo['password'] = "" #password 34 | securityinfo['org_url'] = "http://www.arcgis.com" 35 | securityinfo['proxy_url'] = proxy_url 36 | securityinfo['proxy_port'] = proxy_port 37 | securityinfo['referer_url'] = None 38 | securityinfo['token_url'] = None 39 | securityinfo['certificatefile'] = None 40 | securityinfo['keyfile'] = None 41 | securityinfo['client_id'] = None 42 | securityinfo['secret_id'] = None 43 | 44 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) 45 | if shh.valid == False: 46 | print shh.message 47 | else: 48 | fl= FeatureLayer( 49 | url=url, 50 | securityHandler=shh.securityhandler, 51 | proxy_port=proxy_port, 52 | proxy_url=proxy_url, 53 | initialize=True) 54 | 55 | out_fields = ['objectid'] 56 | for fld in fieldInfo: 57 | out_fields.append(fld['FieldName']) 58 | 59 | resFeats = fl.query(where=sql, 60 | out_fields=",".join(out_fields)) 61 | for feat in resFeats: 62 | 63 | for fld in fieldInfo: 64 | feat.set_value(fld["FieldName"],fld['ValueToSet']) 65 | 66 | print fl.updateFeature(features=resFeats) -------------------------------------------------------------------------------- /samples/update_item.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to update an item 3 | 4 | Python 2.x 5 | ArcREST 3.0.1 6 | """ 7 | import arcrest 8 | from arcresthelper import securityhandlerhelper 9 | def trace(): 10 | """ 11 | trace finds the line, the filename 12 | and error message and returns it 13 | to the user 14 | """ 15 | import traceback, inspect, sys 16 | tb = sys.exc_info()[2] 17 | tbinfo = traceback.format_tb(tb)[0] 18 | filename = inspect.getfile(inspect.currentframe()) 19 | # script name + line number 20 | line = tbinfo.split(", ")[1] 21 | # Get Python syntax error 22 | # 23 | synerror = traceback.format_exc().splitlines()[-1] 24 | return line, filename, synerror 25 | 26 | def main(): 27 | proxy_port = None 28 | proxy_url = None 29 | 30 | securityinfo = {} 31 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 32 | securityinfo['username'] = "" 33 | securityinfo['password'] = "" 34 | securityinfo['org_url'] = "http://www.arcgis.com" 35 | securityinfo['proxy_url'] = proxy_url 36 | securityinfo['proxy_port'] = proxy_port 37 | securityinfo['referer_url'] = None 38 | securityinfo['token_url'] = None 39 | securityinfo['certificatefile'] = None 40 | securityinfo['keyfile'] = None 41 | securityinfo['client_id'] = None 42 | securityinfo['secret_id'] = None 43 | 44 | 45 | itemId = "" 46 | upload_file = r"" 47 | try: 48 | 49 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo) 50 | if shh.valid == False: 51 | print shh.message 52 | else: 53 | portalAdmin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) 54 | item = portalAdmin.content.getItem(itemId=itemId).userItem 55 | 56 | itemParams = arcrest.manageorg.ItemParameter() 57 | 58 | itemParams.filename = upload_file 59 | res = item.updateItem(itemParameters=itemParams, 60 | clearEmptyFields=True, 61 | data=None, 62 | serviceUrl=None, 63 | text=None 64 | ) 65 | 66 | print res 67 | 68 | except: 69 | line, filename, synerror = trace() 70 | print "error on line: %s" % line 71 | print "error in file name: %s" % filename 72 | print "with error message: %s" % synerror 73 | 74 | if __name__ == "__main__": 75 | main() 76 | -------------------------------------------------------------------------------- /samples/update_largethumbnail.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to update the 3 | large thumbnail of an item 4 | Python 2.x 5 | ArcREST 3.0.1 6 | """ 7 | import arcrest 8 | from arcresthelper import securityhandlerhelper 9 | from arcresthelper import common 10 | def trace(): 11 | """ 12 | trace finds the line, the filename 13 | and error message and returns it 14 | to the user 15 | """ 16 | import traceback, inspect, sys 17 | tb = sys.exc_info()[2] 18 | tbinfo = traceback.format_tb(tb)[0] 19 | filename = inspect.getfile(inspect.currentframe()) 20 | # script name + line number 21 | line = tbinfo.split(", ")[1] 22 | # Get Python syntax error 23 | # 24 | synerror = traceback.format_exc().splitlines()[-1] 25 | return line, filename, synerror 26 | 27 | def main(): 28 | proxy_port = None 29 | proxy_url = None 30 | 31 | securityinfo = {} 32 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI 33 | securityinfo['username'] = ""# 34 | securityinfo['password'] = ""# 35 | securityinfo['org_url'] = "http://www.arcgis.com" 36 | securityinfo['proxy_url'] = proxy_url 37 | securityinfo['proxy_port'] = proxy_port 38 | securityinfo['referer_url'] = None 39 | securityinfo['token_url'] = None 40 | securityinfo['certificatefile'] = None 41 | securityinfo['keyfile'] = None 42 | securityinfo['client_id'] = None 43 | securityinfo['secret_id'] = None 44 | 45 | itemId = "" #Item ID 46 | pathToImage = r"" #Path to image 47 | 48 | try: 49 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) 50 | if shh.valid == False: 51 | print shh.message 52 | else: 53 | admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) 54 | content = admin.content 55 | 56 | item = content.getItem(itemId) 57 | itemParams = arcrest.manageorg.ItemParameter() 58 | 59 | itemParams.largeThumbnail = pathToImage 60 | 61 | print item.userItem.updateItem(itemParameters=itemParams) 62 | except (common.ArcRestHelperError),e: 63 | print "error in function: %s" % e[0]['function'] 64 | print "error on line: %s" % e[0]['line'] 65 | print "error in file name: %s" % e[0]['filename'] 66 | print "with error message: %s" % e[0]['synerror'] 67 | if 'arcpyError' in e[0]: 68 | print "with arcpy message: %s" % e[0]['arcpyError'] 69 | 70 | except: 71 | line, filename, synerror = trace() 72 | print "error on line: %s" % line 73 | print "error in file name: %s" % filename 74 | print "with error message: %s" % synerror 75 | 76 | if __name__ == "__main__": 77 | main() -------------------------------------------------------------------------------- /samples/update_rows_to_service_from_dict.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | This sample shows how update a row based on its objectID 4 | 5 | Python 2.x 6 | ArcREST 3.0.1 7 | """ 8 | 9 | from arcresthelper import securityhandlerhelper 10 | 11 | from arcrest.common.general import Feature 12 | 13 | if __name__ == "__main__": 14 | url = ''# URL to Service 15 | proxy_port = None 16 | proxy_url = None 17 | 18 | securityinfo = {} 19 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI, ArcGIS 20 | securityinfo['username'] = "" #User Name 21 | securityinfo['password'] = "" #Password 22 | securityinfo['org_url'] = "http://www.arcgis.com" 23 | securityinfo['proxy_url'] = proxy_url 24 | securityinfo['proxy_port'] = proxy_port 25 | securityinfo['referer_url'] = None 26 | securityinfo['token_url'] = None 27 | securityinfo['certificatefile'] = None 28 | securityinfo['keyfile'] = None 29 | securityinfo['client_id'] = None 30 | securityinfo['secret_id'] = None 31 | 32 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) 33 | if shh.valid == False: 34 | print shh.message 35 | else: 36 | fl= FeatureLayer( 37 | url=url, 38 | securityHandler=shh.securityhandler, 39 | proxy_port=proxy_port, 40 | proxy_url=proxy_url, 41 | initialize=True) 42 | 43 | features = [] 44 | json_string={'geometry': 45 | { 46 | 'y': 1885855.2531960313, 47 | 'x': 1034495.0035156211} 48 | , 49 | 'attributes': 50 | { 'NAME': 'NameChange', 51 | 'OBJECTID': 1 52 | }} 53 | 54 | features.append(Feature(json_string=json_string)) 55 | 56 | 57 | print fl.updateFeature(features=features) -------------------------------------------------------------------------------- /samples/update_user_password.py: -------------------------------------------------------------------------------- 1 | """ 2 | Update a users passwords 3 | 4 | version 3.5.x 5 | Python 2/3 6 | """ 7 | from __future__ import print_function 8 | from arcresthelper import securityhandlerhelper 9 | import arcrest 10 | 11 | if __name__ == "__main__": 12 | 13 | username = ''# Username 14 | 15 | proxy_port = None 16 | proxy_url = None 17 | 18 | securityinfo = {} 19 | securityinfo['security_type'] = 'Portal'#LDAP, NTLM, OAuth, Portal, PKI, ArcGIS 20 | securityinfo['username'] = "" #User Name 21 | securityinfo['password'] = "" #password 22 | securityinfo['org_url'] = "https://www.arcgis.com" 23 | securityinfo['proxy_url'] = proxy_url 24 | securityinfo['proxy_port'] = proxy_port 25 | securityinfo['referer_url'] = None 26 | securityinfo['token_url'] = None 27 | securityinfo['certificatefile'] = None 28 | securityinfo['keyfile'] = None 29 | securityinfo['client_id'] = None 30 | securityinfo['secret_id'] = None 31 | 32 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo=securityinfo) 33 | if shh.valid == False: 34 | print (shh.message) 35 | else: 36 | admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler, initialize=True) 37 | user = admin.community.users.user(str(username).strip()) 38 | print (user.update(password="1234testtest")) 39 | -------------------------------------------------------------------------------- /samples/walk_directory and_add_files_of_filetype.py: -------------------------------------------------------------------------------- 1 | """ 2 | This sample shows how to recursively walk into a parent directory, find all files matching a specific file extension 3 | and add them to your ArcGIS Online organization. 4 | 5 | Python 2.x 6 | ArcREST 3.0.1 7 | """ 8 | import arcpy.AddMessage 9 | import os 10 | import arcrest 11 | from arcresthelper import securityhandlerhelper 12 | 13 | org_url = 'http://www.arcgis.com' 14 | username = '' 15 | password = '' 16 | 17 | top_level_directory = r'D:\files' 18 | file_extension = '.pdf' 19 | file_tags = 'pdf' 20 | file_type = 'PDF' 21 | 22 | proxy_port = None 23 | proxy_url = None 24 | 25 | 26 | # create security dictionary object 27 | securityinfo = dict( 28 | security_type='Portal', #LDAP, NTLM, OAuth, Portal, PKI 29 | username=username, 30 | password=password, 31 | org_url=org_url, 32 | proxy_url=proxy_url, 33 | proxy_port=proxy_port, 34 | referer_url=None, 35 | token_url=None, 36 | certificatefile=None, 37 | keyfile=None, 38 | client_id=None, 39 | secret_id=None 40 | ) 41 | 42 | shh = securityhandlerhelper.securityhandlerhelper(securityinfo) 43 | 44 | if shh.valid == False: 45 | print shh.message 46 | 47 | else: 48 | admin = arcrest.manageorg.Administration(securityHandler=shh.securityhandler) 49 | content = admin.content 50 | userInfo = content.users.user() 51 | 52 | # walk into the top level directory 53 | for top_dir, dir_list, file_list in os.walk(top_level_directory): 54 | 55 | for this_file in file_list: 56 | 57 | # check to see if the file extension matches 58 | if os.path.splitext(this_file) == file_extension: 59 | 60 | # get the full file path 61 | file_path = os.path.join(top_dir, this_file) 62 | 63 | # create item parameter object instance 64 | itemParams = arcrest.manageorg.ItemParameter() 65 | 66 | # get the title from the file name 67 | itemParams.title = os.path.split(os.path.basename(file_path))[0] 68 | 69 | # set the file type, pretty boring 70 | itemParams.type = file_type 71 | 72 | # overwrite - if the item already exists, it will be overwritten 73 | itemParams.overwrite = True 74 | 75 | # set tags 76 | itemParams.tags = file_tags 77 | 78 | # set the snippet to simply be the file name with the extension 79 | itemParams.snippet = os.path.basename(file_path) 80 | 81 | # set the type keywords to the same thing as the tags for now 82 | itemParams.typeKeywords = file_tags 83 | 84 | # this is just the entire path to the file 85 | itemParams.filename = file_path 86 | 87 | # with the item parameters set up, now upload the file 88 | item = userInfo.addItem( 89 | itemParameters=itemParams, 90 | overwrite=True, 91 | relationshipType=None, 92 | originItemId=None, 93 | destinationItemId=None, 94 | serviceProxyParams=None, 95 | metadata=None 96 | ) 97 | 98 | # display success 99 | arcpy.AddMessage("{} successfully uploaded and ArcGIS Online item created.".format(item.title)) 100 | 101 | -------------------------------------------------------------------------------- /src/README.rst: -------------------------------------------------------------------------------- 1 | ArcREST Version 3.5.x 2 | ===================== 3 | 4 | A latest release(v3.5.9) of ArcREST can be downloaded here: 5 | https://github.com/Esri/ArcREST/releases/tag/3.5.9 \* If you are using 6 | an older version(v3.0.1) of ArcRest, you can find it here: 7 | https://github.com/Esri/ArcREST/releases/tag/v3.0.1 \* If you are using 8 | an older version(v2) of ArcRest, you can find it here: 9 | https://github.com/Esri/ArcREST/tree/FinalV2 \* If you are using an 10 | older version(v1) of ArcRest, you can find it here: 11 | https://github.com/Esri/ArcREST/tree/October2014v1.0Final 12 | 13 | A set of python tools to assist working with ArcGIS REST API for ArcGIS 14 | Server (AGS), ArcGIS Online (AGOL), and ArcGIS WebMap JSON. 15 | 16 | This is not a full implementation of the Esri REST API, but we would 17 | like to make it, so help out! Please feel free to contribute. 18 | 19 | Features 20 | -------- 21 | 22 | - Add, Delete, Update and Query Feature Services 23 | - Upload attachments to feature services 24 | - Assists in managing and publishing content 25 | - Allows users to control, migrate and update online content 26 | - Manage users on Portal, ArcGIS Server, and ArcGIS Online sites 27 | - Plus additional information not even listed here! 28 | 29 | Requirements 30 | ------------ 31 | 32 | - Python 2.7.x/Python 3.4 (https://www.python.org/) 33 | - numpy >= 1.7.1 (numpy is included with ArcGIS default installation) 34 | - [STRIKEOUT:Six (https://pypi.python.org/pypi/six)] (Six is included 35 | in current version) 36 | - pip (https://pip.pypa.io/en/stable/installing/) 37 | 38 | Getting Started 39 | --------------- 40 | 41 | Fetch your folders: 42 | 43 | .. code:: python 44 | 45 | import arcrest 46 | from arcresthelper import securityhandlerhelper 47 | 48 | config = {'username': 'myusername', 'password': 'myp4ssword'} 49 | token = securityhandlerhelper.securityhandlerhelper(config) 50 | admin = arcrest.manageorg.Administration(securityHandler=token.securityhandler) 51 | content = admin.content 52 | userInfo = content.users.user() 53 | userInfo.folders 54 | 55 | Get item metadata: 56 | 57 | .. code:: python 58 | 59 | item = admin.content.getItem(itemId=itemId) 60 | item.title 61 | u'Streets' 62 | 63 | Issues 64 | ------ 65 | 66 | Find a bug or want to request a new feature? Please let us know by 67 | submitting an issue. 68 | 69 | Contributing 70 | ------------ 71 | 72 | Esri welcomes contributions from anyone and everyone. Please see our 73 | `guidelines for contributing `__. 74 | 75 | 76 | Licensing 77 | --------- 78 | 79 | Copyright 2016 Esri 80 | 81 | Licensed under the Apache License, Version 2.0 (the "License"); you may 82 | not use this file except in compliance with the License. You may obtain 83 | a copy of the License at 84 | 85 | http://www.apache.org/licenses/LICENSE-2.0 86 | 87 | Unless required by applicable law or agreed to in writing, software 88 | distributed under the License is distributed on an "AS IS" BASIS, 89 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 90 | See the License for the specific language governing permissions and 91 | limitations under the License. 92 | -------------------------------------------------------------------------------- /src/arcrest/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .constants import * 3 | from . import agol 4 | from . import ags 5 | from .security import * 6 | from .common import * 7 | from . import _abstract 8 | from . import web 9 | from . import manageorg 10 | from . import manageags 11 | from . import manageportal 12 | from . import hostedservice 13 | from . import opendata 14 | from . import cmp 15 | from . import packages 16 | #import webmap 17 | from .geometryservice import * 18 | from .enrichment import GeoEnrichment 19 | try: 20 | import arcpy 21 | arcpyFound = True 22 | except: 23 | arcpyFound = False 24 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/_abstract/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from . import abstract 3 | 4 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/agol/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .services import FeatureService, FeatureLayer, TableLayer, TiledService 3 | from . import helperservices 4 | from ._uploads import Uploads 5 | 6 | __version__ = "3.5.9" 7 | -------------------------------------------------------------------------------- /src/arcrest/agol/helperservices/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .analysis import * 3 | from .elevation import * 4 | from .hydrology import * 5 | #from .geocoder import * 6 | __version__ = "3.5.9" 7 | -------------------------------------------------------------------------------- /src/arcrest/agol/helperservices/geocoder.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from ...ags._geocodeservice import GeocodeService 3 | 4 | class geocode(GeocodeService): 5 | """ agol geocode object """ 6 | pass -------------------------------------------------------------------------------- /src/arcrest/ags/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .featureservice import * 3 | from .mapservice import * 4 | from .layer import * 5 | from ._geoprocessing import * 6 | from ._gpobjects import * 7 | from ._imageservice import ImageService 8 | from ._uploads import Uploads 9 | from ._globeservice import GlobeService, GlobeServiceLayer 10 | from ._mobileservice import MobileService, MobileServiceLayer 11 | from ._geodataservice import GeoDataService 12 | from ._geocodeservice import GeocodeService 13 | from ._vectortile import VectorTileService 14 | from .server import Server as AGSServer 15 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/cmp/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from . import community 3 | 4 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/common/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from . import spatial 3 | from . import general 4 | from . import geometry 5 | from . import filters 6 | from . import servicedef 7 | from . import find 8 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/common/errorhandlers.py: -------------------------------------------------------------------------------- 1 | """ 2 | contains all error handlers for ArcREST 3 | """ 4 | from __future__ import absolute_import 5 | from __future__ import print_function 6 | MSGS = { 7 | 100 : "100: Invalid Inputs", 8 | 200 : "200: Error with the GET Operation", 9 | 201 : "201: Error with the POST operation", 10 | 202 : "202: Error with the MultiPart POST operation", 11 | 203 : "203: Error with the download operation", 12 | 400 : "Invalid Username/Password", 13 | 401 : "Invalid token. Check the username and password and try again.", 14 | 404 : "Invalid URL", 15 | -99999 : "An unknown error has been raised." 16 | 17 | } 18 | import json 19 | #-------------------------------------------------------------------------- 20 | def trace(): 21 | """ 22 | trace finds the line, the filename 23 | and error message and returns it 24 | to the user 25 | """ 26 | import traceback 27 | import sys, inspect 28 | tb = sys.exc_info()[2] 29 | tbinfo = traceback.format_tb(tb)[0] 30 | # script name + line number 31 | line = tbinfo.split(", ")[1] 32 | # Get Python syntax error 33 | # 34 | synerror = traceback.format_exc().splitlines()[-1] 35 | return line, __file__, synerror 36 | ######################################################################## 37 | class ArcRESTError(Exception): 38 | """default type of error handler raised""" 39 | pass -------------------------------------------------------------------------------- /src/arcrest/constants.py: -------------------------------------------------------------------------------- 1 | """ 2 | This module contains system level constants that will carry throughout the 3 | project. 4 | """ 5 | ######################################################################## 6 | __version__ = "3.5.9" 7 | """ 8 | VERIFY_SSL_CERTIFICATES is a system level setting that allows for the by-pass of 9 | less secure sites where the SSL certificates may be expired or invalid. 10 | True means all SSL certificates must be valid 11 | False means it will ignore all SSL invalid certificates (insecure) 12 | """ 13 | VERIFY_SSL_CERTIFICATES = False 14 | """ 15 | USER_AGENT identify the browser and operating system to the web server. 16 | """ 17 | USER_AGENT = "ArcREST/%s" % __version__ 18 | """ 19 | DEFAULTTOKENEXPIRATION - is the timeout of the token in minutes 20 | Default is 100 as an integer. 21 | """ 22 | DEFAULT_TOKEN_EXPIRATION = 100 -------------------------------------------------------------------------------- /src/arcrest/enrichment/__countrycodes.csv: -------------------------------------------------------------------------------- 1 | Country_Name,Two_Digit_Country_Code,Three_Digit_Country_Code 2 | United States,US,USA 3 | Albania,AL,ALB 4 | Algeria,DZ,DZA 5 | Andorra,AD,AND 6 | Angola,AO,AGO 7 | Argentina,AR,ARG 8 | Armenia,AM,ARM 9 | Aruba,AW,ABW 10 | Australia,AU,AUS 11 | Austria,AT,AUT 12 | Azerbaijan,AZ,AZE 13 | Bahamas,BS,BHS 14 | Bahrain,BH,BHR 15 | Bangladesh,BD,BGD 16 | Belarus,BY,BLR 17 | Belgium,BE,BEL 18 | Bermuda,BM,BMU 19 | Bolivia,BO,BOL 20 | Bosnia and Herzegovina,BA,BIH 21 | Botswana,BW,BWA 22 | Brazil,BR,BRA 23 | Bulgaria,BG,BGR 24 | Cameroon,CM,CMR 25 | Canada,CA,CAN 26 | Cayman Islands,KY,CYM 27 | Chile,CL,CHL 28 | China,CN,CHN 29 | Colombia,CO,COL 30 | Costa Rica,CR,CRI 31 | Cote d'Ivoire,CI,CIV 32 | Croatia,HR,HRV 33 | Cyprus,CY,CYP 34 | Czech Republic,CZ,CZE 35 | Denmark,DK,DNK 36 | Dominican Republic,DO,DOM 37 | Ecuador,EC,ECU 38 | Egypt,EG,EGY 39 | El Salvador,SV,SLV 40 | Estonia,EE,EST 41 | Faroe Islands,FO,FRO 42 | Finland,FI,FIN 43 | France,FR,FRA 44 | French Polynesia,PF,PYF 45 | Georgia,GE,GEO 46 | Germany,DE,DEU 47 | Ghana,GH,GHA 48 | Greece,GR,GRC 49 | Greenland,GL,GRL 50 | Guadaloupe,GP,GLP 51 | Guatemala,GT,GTM 52 | Honduras,HN,HND 53 | Hong Kong,HK,HKG 54 | Hungary,HU,HUN 55 | Iceland,IS,ISL 56 | India,IN,IND 57 | Indonesia,ID,IDN 58 | Ireland,IE,IRL 59 | Israel,IL,ISR 60 | Italy,IT,ITA 61 | Jamaica,JM,JAM 62 | Japan,JP,JPN 63 | Jordan,JO,JOR 64 | Kazakhstan,KZ,KAZ 65 | Kenya,KE,KEN 66 | Kosovo,XK,XKS 67 | Kuwait,KW,KWT 68 | Kyrgyzstan,KG,KGZ 69 | Latvia,LV,LVA 70 | Lebanon,LB,LBN 71 | Lesotho,LS,LSO 72 | Liechtenstein,LI,LIE 73 | Lithuania,LT,LTU 74 | Luxembourg,LU,LUX 75 | Macao,MO,MAC 76 | Malawi,MW,MWI 77 | Malaysia,MY,MYS 78 | Malta,MT,MLT 79 | Martinique,MQ,MTQ 80 | Mauritius,MU,MUS 81 | Mexico,MX,MEX 82 | Moldova,MD,MDA 83 | Monaco,MC,MCO 84 | Mongolia,MN,MNG 85 | Montenegro,ME,MNE 86 | Morocco,MA,MAR 87 | Mozambique,MZ,MOZ 88 | Namibia,NA,NAM 89 | Netherlands,NL,NLD 90 | New Caledonia,NC,NCL 91 | New Zealand,NZ,NZL 92 | Nicaragua,NI,NIC 93 | Nigeria,NG,NGA 94 | Norway,NO,NOR 95 | Oman,OM,OMN 96 | Pakistan,PK,PAK 97 | Panama,PA,PAN 98 | Paraguay,PY,PRY 99 | Peru,PE,PER 100 | Philippines,PH,PHL 101 | Poland,PL,POL 102 | Portugal,PT,PRT 103 | Puerto Rico,PR,PRI 104 | Qatar,QA,QAT 105 | Reunion,RE,REU 106 | Romania,RO,ROU 107 | Russia,RU,RUS 108 | Saudi Arabia,SA,SAU 109 | Serbia,RS,SRB 110 | Singapore,SG,SGP 111 | Slovakia,SK,SVK 112 | Slovenia,SI,SVN 113 | South Africa,ZA,ZAF 114 | South Korea,KR,KOR 115 | Spain,ES,ESP 116 | Sri Lanka,LK,LKA 117 | Sudan,SD,SDN 118 | Swaziland,SZ,SWZ 119 | Sweden,SE,SWE 120 | Switzerland,CH,CHE 121 | Syria,SY,SYR 122 | Taiwan,TW,TWN 123 | Tajikistan,TJ,TJK 124 | Tanzania,TZ,TZA 125 | Thailand,TH,THA 126 | The Former Yugoslav Republic of Macedonia,MK,MKD 127 | Trinidad and Tobago,TT,TTO 128 | Tunisia,TN,TUN 129 | Turkey,TR,TUR 130 | Uganda,UG,UGA 131 | Ukraine,UA,UKR 132 | United Arab Emirates,AE,ARE 133 | United Kingdom,GB,GBR 134 | Uruguay,UY,URY 135 | Uzbekistan,UZ,UZB 136 | Venezuela,VE,VEN 137 | Vietnam,VN,VNM 138 | Zambia,ZM,ZMB 139 | -------------------------------------------------------------------------------- /src/arcrest/enrichment/__datacollectionnames.csv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/src/arcrest/enrichment/__datacollectionnames.csv -------------------------------------------------------------------------------- /src/arcrest/enrichment/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | The GeoEnrichment service provides the ability to get facts about a 3 | location or area. Using GeoEnrichment, you can get information about the 4 | people, places, and businesses in a specific area or within a certain 5 | distance or drive time from a location. More specifically, by submitting a 6 | point or polygon to the GeoEnrichment service, you can retrieve the 7 | demographics and other relevant characteristics associated with the 8 | surrounding area. You can also use the geoenrichment service to obtain 9 | additional geographic context (for example, the ZIP Code of a location) and 10 | geographic boundaries (for example, the geometry for a drive-time service 11 | area). Currently, the service is available for Canada, the United States, 12 | and a number of European countries. Other countries will be added in the 13 | near future. 14 | This service enables you to answer questions about locations that you can't 15 | answer with maps alone. For example: What kind of people live here? What do 16 | people like to do in this area? What are their habits and lifestyles? What 17 | kind of businesses are in this area? 18 | Site analysis is a popular application of this type of data enrichment. For 19 | example, the GeoEnrichment service can be leveraged to study the population 20 | that would be affected by the development of a new community center within 21 | their neighborhood. With the service, the proposed site can be submitted, 22 | and the demographics and other relevant characteristics associated with the 23 | area around the site will be returned. 24 | """ 25 | from __future__ import absolute_import 26 | from ._geoenrichment import GeoEnrichment 27 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/geometryservice/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .geometryservice import GeometryService 3 | 4 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/hostedservice/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .service import AdminFeatureService, AdminFeatureServiceLayer, AdminMapService, Services 3 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/manageags/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .administration import AGSAdministration 3 | from .parameters import ClusterProtocol, Extension 4 | 5 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/manageags/_kml.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from __future__ import print_function 3 | from .._abstract.abstract import BaseAGSServer 4 | 5 | ######################################################################## 6 | class KML(BaseAGSServer): 7 | """ 8 | This resource is a container for all the KMZ files created on the 9 | server. 10 | """ 11 | _securityHandler = None 12 | _items = None 13 | _proxy_port = None 14 | _proxy_url = None 15 | #---------------------------------------------------------------------- 16 | def __init__(self, url, securityHandler, 17 | initialize=False, proxy_url=None, proxy_port=None): 18 | """Constructor 19 | Inputs: 20 | url - admin url 21 | securityHandler - handles site security 22 | """ 23 | self._proxy_port = proxy_port 24 | self._proxy_url = proxy_url 25 | self._url = url 26 | self._securityHandler = securityHandler 27 | if initialize: 28 | self.__init() 29 | #---------------------------------------------------------------------- 30 | def __init(self): 31 | """ populates server admin information """ 32 | params = { 33 | "f" : "json" 34 | } 35 | json_dict = self._get(url=self._url, 36 | param_dict=params, 37 | securityHandler=self._securityHandler, 38 | proxy_url=self._proxy_url, 39 | proxy_port=self._proxy_port) 40 | attributes = [attr for attr in dir(self) 41 | if not attr.startswith('__') and \ 42 | not attr.startswith('_')] 43 | for k,v in json_dict.items(): 44 | if k in attributes: 45 | setattr(self, "_"+ k, json_dict[k]) 46 | else: 47 | print( k, " - attribute not implemented for KML") 48 | del k 49 | del v 50 | #---------------------------------------------------------------------- 51 | def createKMZ(self, kmz_as_json): 52 | """ 53 | Creates a KMZ file from json. 54 | See http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Create_Kmz/02r3000001tm000000/ 55 | for more information. 56 | """ 57 | kmlURL = self._url + "/createKmz" 58 | params = { 59 | "f" : "json", 60 | "kml" : kmz_as_json 61 | } 62 | return self._post(url=kmlURL, param_dict=params, 63 | securityHandler=self._securityHandler, 64 | proxy_url=self._proxy_url, 65 | proxy_port=self._proxy_port) 66 | #---------------------------------------------------------------------- 67 | @property 68 | def items(self): 69 | """ returns list of KMZ/KML on server """ 70 | if self._items is None: 71 | self.__init() 72 | return self._items 73 | -------------------------------------------------------------------------------- /src/arcrest/manageorg/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .administration import Administration 3 | from ._parameters import * 4 | 5 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/manageorg/_content_constants.py: -------------------------------------------------------------------------------- 1 | """ 2 | Contains constants to determine if an item type has a file or not to help 3 | tasks related to moving, updating or managing one's content on Portal or 4 | ArcGIS Online. 5 | """ 6 | from __future__ import absolute_import 7 | from __future__ import print_function 8 | URL_BASED_ITEM_TYPES = ('Feature Service', 'Map Service', 9 | 'Image Service', 'Web Mapping Application','WMS','WMTS', 'Geodata Service', 10 | 'Globe Service','Geometry Service', 'Geocoding Service', 11 | 'Network Analysis Service', 'Geoprocessing Service','Mobile Application') 12 | 13 | TEXT_BASED_ITEM_TYPES = ('Web Map', 'Feature Service', 'Map Service', 14 | 'Image Service', 'Feature Collection', 'Feature Collection Template', 15 | 'Web Mapping Application', 'Mobile Application', 'Symbol Set', 'Color Set', 16 | 'Windows Viewer Configuration') 17 | 18 | FILE_BASED_ITEM_TYPES = ('Code Attachment', 'Shapefile', 'CSV', 19 | 'Service Definition', 'Map Document', 'Map Package', 'Tile Package', 20 | 'Explorer Map', 'Globe Document', 'Scene Document', 'Published Map', 21 | 'Map Template', 'Windows Mobile Package', 'Layer', 'Layer Package', 22 | 'Explorer Layer', 'Geoprocessing Package', 'Geoprocessing Sample', 23 | 'Locator Package', 'Workflow Manager Package', 'Code Sample', 24 | 'Desktop Application Template', 'Desktop Add In', 'Explorer Add In', 25 | 'CityEngine Web Scene', 'Windows Viewer Add In') 26 | 27 | RELATIONSHIP_TYPES = ('Map2Service', 'WMA2Code', 28 | 'Map2FeatureCollection', 'MobileApp2Code', 'Service2Data', 29 | 'Service2Service') 30 | 31 | RELATIONSHIP_DIRECTIONS = ('forward', 'reverse') 32 | 33 | URL_ITEM_FILTER = ' OR '.join(['type:"%s"' % t for t in URL_BASED_ITEM_TYPES]) \ 34 | + ' -type:"Web Map" -type:"Map Package"' 35 | 36 | WEB_ITEM_FILTER = '((type:"service" -type:"globe" -type:"geodata") OR ' \ 37 | + 'type:"KML" OR type:"WMS" OR type:"Web Map" OR ' \ 38 | + 'type:"web mapping application" OR (type:"feature collection" ' \ 39 | + '-type:"Feature Collection Template") OR ' \ 40 | + 'type:"mobile application")' 41 | WEBMAP_ITEM_FILTER = 'type:"Web Map" -type:"Web Mapping Application"' 42 | EXCLUDE_BASEMAP_FILTER = ' -tags:basemap' 43 | -------------------------------------------------------------------------------- /src/arcrest/manageorg/_marketplace.py: -------------------------------------------------------------------------------- 1 | """ 2 | Module that controls marketplace functions 3 | TODO 4 | """ 5 | from __future__ import absolute_import 6 | from __future__ import print_function -------------------------------------------------------------------------------- /src/arcrest/manageportal/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | from .administration import PortalAdministration, _log, _Security, _System 3 | 4 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/opendata/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | initializer code. 3 | """ 4 | from __future__ import absolute_import 5 | from .opendata import OpenDataItem, OpenData 6 | from ._web import WebOperations -------------------------------------------------------------------------------- /src/arcrest/opendata/_base.py: -------------------------------------------------------------------------------- 1 | class BaseOpenData(object): pass -------------------------------------------------------------------------------- /src/arcrest/packages/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import six 4 | from . import ntlm3 -------------------------------------------------------------------------------- /src/arcrest/packages/ntlm3/__init__.py: -------------------------------------------------------------------------------- 1 | 2 | from . import HTTPNtlmAuthHandler # noqa 3 | 4 | 5 | __all__ = ('HTTPNtlmAuthHandler') 6 | -------------------------------------------------------------------------------- /src/arcrest/packages/ntlm3/compat.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | def _long(value): 4 | try: 5 | return long(value) 6 | except NameError: # we're Python 3, we don't have longs 7 | return int(value) 8 | -------------------------------------------------------------------------------- /src/arcrest/packages/ntlm3/des.py: -------------------------------------------------------------------------------- 1 | # This file is part of 'NTLM Authorization Proxy Server' http://sourceforge.net/projects/ntlmaps/ 2 | # Copyright 2001 Dmitry A. Rozmanov 3 | # 4 | # This library is free software: you can redistribute it and/or 5 | # modify it under the terms of the GNU Lesser General Public 6 | # License as published by the Free Software Foundation, either 7 | # version 3 of the License, or (at your option) any later version. 8 | 9 | # This library is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | # Lesser General Public License for more details. 13 | # 14 | # You should have received a copy of the GNU Lesser General Public 15 | # License along with this library. If not, see or . 16 | from .. import six 17 | import logging 18 | 19 | from . import des_c 20 | 21 | 22 | log = logging.getLogger(__name__) 23 | 24 | 25 | class DES: 26 | des_c_obj = None 27 | 28 | def __init__(self, key_str): 29 | k = str_to_key56(key_str) 30 | k = key56_to_key64(k) 31 | 32 | key_str = b'' 33 | for i in k: 34 | key_str += six.int2byte(i & 0xFF) 35 | 36 | self.des_c_obj = des_c.DES(key_str) 37 | 38 | def encrypt(self, plain_text): 39 | return self.des_c_obj.encrypt(plain_text) 40 | 41 | def decrypt(self, crypted_text): 42 | return self.des_c_obj.decrypt(crypted_text) 43 | 44 | 45 | DESException = 'DESException' 46 | 47 | 48 | def str_to_key56(key_str): 49 | 50 | if not type(key_str) == six.binary_type: 51 | # TODO rsanders high - figure out how to make this not necessary 52 | key_str = key_str.encode('ascii') 53 | 54 | if len(key_str) < 7: 55 | key_str = key_str + b'\000\000\000\000\000\000\000'[:(7 - len(key_str))] 56 | key_56 = [] 57 | for i in six.iterbytes(key_str[:7]): 58 | key_56.append(i) 59 | 60 | return key_56 61 | 62 | 63 | def key56_to_key64(key_56): 64 | key = [] 65 | for i in range(8): 66 | key.append(0) 67 | 68 | key[0] = key_56[0] 69 | key[1] = ((key_56[0] << 7) & 0xFF) | (key_56[1] >> 1) 70 | key[2] = ((key_56[1] << 6) & 0xFF) | (key_56[2] >> 2) 71 | key[3] = ((key_56[2] << 5) & 0xFF) | (key_56[3] >> 3) 72 | key[4] = ((key_56[3] << 4) & 0xFF) | (key_56[4] >> 4) 73 | key[5] = ((key_56[4] << 3) & 0xFF) | (key_56[5] >> 5) 74 | key[6] = ((key_56[5] << 2) & 0xFF) | (key_56[6] >> 6) 75 | key[7] = (key_56[6] << 1) & 0xFF 76 | 77 | key = set_key_odd_parity(key) 78 | 79 | return key 80 | 81 | 82 | def set_key_odd_parity(key): 83 | for i in range(len(key)): 84 | for k in range(7): 85 | bit = 0 86 | t = key[i] >> k 87 | bit = (t ^ bit) & 0x1 88 | key[i] = (key[i] & 0xFE) | bit 89 | 90 | return key 91 | -------------------------------------------------------------------------------- /src/arcrest/security/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from .security import LDAPSecurityHandler, NTLMSecurityHandler, OAuthSecurityHandler, AGOLTokenSecurityHandler,\ 4 | AGSTokenSecurityHandler, ArcGISTokenSecurityHandler, PKISecurityHandler, PortalServerSecurityHandler, \ 5 | PortalTokenSecurityHandler, CommunityMapsSecurityHandler 6 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/web/__init__.py: -------------------------------------------------------------------------------- 1 | """ 2 | _web constructor 3 | """ 4 | from __future__ import absolute_import 5 | from . import _base 6 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcrest/webmap/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | import domain 3 | import renderer 4 | import symbols 5 | import operationallayers 6 | __version__ = "3.5.9" -------------------------------------------------------------------------------- /src/arcresthelper/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import common 4 | from . import featureservicetools 5 | from . import orgtools 6 | from . import portalautomation 7 | from . import publishingtools 8 | from . import resettools 9 | 10 | __version__ = "3.0.1" 11 | -------------------------------------------------------------------------------- /src/arcresthelper/packages/__init__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | from . import six -------------------------------------------------------------------------------- /src/requirements.txt: -------------------------------------------------------------------------------- 1 | six>=1.1.0 2 | numpy>=1.7.1 -------------------------------------------------------------------------------- /src/setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | # This flag says that the code is written to work on both Python 2 and Python 3 | # 3. If at all possible, it is good practice to do this. If you cannot, you 4 | # will need to generate wheels for each Python version that you support. 5 | universal=1 -------------------------------------------------------------------------------- /src/setup.py: -------------------------------------------------------------------------------- 1 | """ 2 | ArcREST Setup Code 3 | 4 | """ 5 | from distutils.core import setup 6 | from codecs import open 7 | from os import path 8 | 9 | 10 | here = path.abspath(path.dirname(__file__)) 11 | 12 | packages = ['arcresthelper','arcresthelper/packages', 13 | 'arcrest','arcrest/agol','arcrest/agol/helperservices', 'arcrest/ags', 'arcrest/common', 14 | 'arcrest/manageorg', 'arcrest/security', 'arcrest/web', 15 | 'arcrest/_abstract', 'arcrest/webmap', 'arcrest/geometryservice', 16 | 'arcrest/manageags', 'arcrest/manageportal', 'arcrest/hostedservice', 17 | 'arcrest/enrichment', 'arcrest/opendata', 'arcrest/cmp', 'arcrest/packages', 18 | 'arcrest/packages/ntlm3'] 19 | 20 | # Get the long description from the README file 21 | try: 22 | with open(path.join(here, 'README.rst'), encoding='utf-8') as f: 23 | long_decription = f.read() 24 | except: 25 | long_decription = "ArcREST Python Package" 26 | 27 | setup( 28 | name='ArcREST', 29 | 30 | # Versions should comply with PEP440. For a discussion on single-sourcing 31 | # the version across setup.py and the project code, see 32 | # https://packaging.python.org/en/latest/single_source_version.html 33 | version='3.5.6', 34 | 35 | description='ArcREST is a Python Wrapper for the Esri REST Framework', 36 | long_description=long_decription, 37 | # The project's main homepage. 38 | url='https://github.com/Esri/ArcREST', 39 | # Author details 40 | author='Andrew Chapkowski, Mike Miller', 41 | author_email='achapkowski@esri.com, mmiller@esri.com', 42 | # Choose your license 43 | license='Apache', 44 | classifiers=[ 45 | 'Development Status :: 5 - Production/Stable', 46 | # Indicate who your project is intended for 47 | 'Intended Audience :: Developers/GIS Users', 48 | 'Topic :: Software Development :: Esri REST API', 49 | 50 | # Pick your license as you wish (should match "license" above) 51 | 'License :: Apache License', 52 | 53 | # Specify the Python versions you support here. In particular, ensure 54 | # that you indicate whether you support Python 2, Python 3 or both. 55 | 'Programming Language :: Python :: 2.7', 56 | 'Programming Language :: Python :: 3', 57 | 'Programming Language :: Python :: 3.2', 58 | 'Programming Language :: Python :: 3.3', 59 | 'Programming Language :: Python :: 3.4', 60 | 'Programming Language :: Python :: 3.5' 61 | ], 62 | keywords='REST, Esri, ArcGIS, Python, ArcPy', 63 | packages=packages, 64 | include_package_data=True, 65 | zip_safe=False, 66 | install_requires=['numpy>=1.7.1'], 67 | extras_require={}, 68 | package_data={'arcrest/enrichment' : ['__countrycodes.csv', '__datacollectionnames.csv']}, 69 | ) 70 | -------------------------------------------------------------------------------- /src/setup_wheel.py: -------------------------------------------------------------------------------- 1 | """ 2 | ArcREST Setup Code 3 | 4 | """ 5 | from setuptools import setup, find_packages 6 | from codecs import open 7 | from os import path 8 | import re 9 | 10 | with open('arcrest/__init__.py', 'r') as fd: 11 | version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', 12 | fd.read(), re.MULTILINE).group(1) 13 | 14 | 15 | 16 | here = path.abspath(path.dirname(__file__)) 17 | 18 | packages = ['arcresthelper','arcresthelper/packages', 19 | 'arcrest','arcrest/agol','arcrest/agol/helperservices', 'arcrest/ags', 'arcrest/common', 20 | 'arcrest/manageorg', 'arcrest/security', 'arcrest/web', 21 | 'arcrest/_abstract', 'arcrest/webmap', 'arcrest/geometryservice', 22 | 'arcrest/manageags', 'arcrest/manageportal', 'arcrest/hostedservice', 23 | 'arcrest/enrichment', 'arcrest/opendata', 'arcrest/cmp', 'arcrest/packages', 24 | 'arcrest/packages/ntlm3'] 25 | 26 | # Get the long description from the README file 27 | try: 28 | with open(path.join(here, 'README.rst'), encoding='utf-8') as f: 29 | long_decription = f.read() 30 | except: 31 | long_decription = "ArcREST Python Package" 32 | 33 | setup( 34 | name='ArcREST_Package', 35 | 36 | # Versions should comply with PEP440. For a discussion on single-sourcing 37 | # the version across setup.py and the project code, see 38 | # https://packaging.python.org/en/latest/single_source_version.html 39 | version=version, 40 | 41 | description='ArcREST is a Python Wrapper for the Esri REST Framework', 42 | long_description=long_decription, 43 | # The project's main homepage. 44 | url='https://github.com/Esri/ArcREST', 45 | # Author details 46 | author='Andrew Chapkowski, Mike Miller', 47 | author_email='achapkowski@esri.com, mmiller@esri.com', 48 | # Choose your license 49 | license='Apache 2.0', 50 | classifiers=[ 51 | 'Development Status :: 5 - Production/Stable', 52 | # Indicate who your project is intended for 53 | 'Intended Audience :: Developers', 54 | 'Natural Language :: English', 55 | 'License :: OSI Approved :: Apache Software License', 56 | 'Programming Language :: Python', 57 | 'Programming Language :: Python :: 2.6', 58 | 'Programming Language :: Python :: 2.7', 59 | 'Programming Language :: Python :: 3', 60 | 'Programming Language :: Python :: 3.3', 61 | 'Programming Language :: Python :: 3.4', 62 | 'Programming Language :: Python :: 3.5', 63 | 'Programming Language :: Python :: Implementation :: PyPy' 64 | ], 65 | keywords='REST, Esri, ArcGIS, Python, ArcPy', 66 | packages=packages, 67 | include_package_data=True, 68 | zip_safe=True, 69 | install_requires=['numpy>=1.7.1'], 70 | extras_require={}, 71 | package_data={'arcrest/enrichment' : ['__countrycodes.csv', '__datacollectionnames.csv']}, 72 | ) 73 | -------------------------------------------------------------------------------- /tests/enrichment_tests.py: -------------------------------------------------------------------------------- 1 | """ 2 | Testing for geoenrichment functions 3 | """ 4 | import tempfile 5 | from arcrest.common.geometry import Polygon, Point 6 | from arcrest import AGOLTokenSecurityHandler 7 | from arcrest import GeoEnrichment 8 | if __name__ == "__main__": 9 | username = "" 10 | password = "" 11 | sh = AGOLTokenSecurityHandler(username, password) 12 | g = GeoEnrichment(securityHanlder=sh) 13 | print g.allowedCountryNames 14 | print g.allowedThreeDigitNames 15 | print g.allowedTwoDigitCountryCodes 16 | print g.findCountryThreeDigitCode(g.allowedCountryNames[11]) 17 | print g.findCountryTwoDigitCode(g.allowedCountryNames[11]) 18 | print g.queryDataCollectionByName(g.allowedCountryNames[11]) 19 | print g.getVariables(sourceCountry='HKG') 20 | print g.getVariables(sourceCountry='HKG', searchText="alias:2012 Population Per Mill") 21 | print g.lookUpReportsByCountry(countryName="Panama") 22 | print g.createReport( 23 | out_file_path=tempfile.gettempdir(), 24 | studyAreas=Point(coord=[-117.1956, 34.0572], wkid=4326)) 25 | print g.createReport(out_file_path=tempfile.gettempdir(), 26 | report="networth", 27 | studyAreas=Polygon(rings=[[[-117.185412,34.063170], 28 | [-122.81,37.81], 29 | [-117.200570,34.057196], 30 | [-117.185412,34.063170]]], wkid=4326) 31 | ) 32 | print g.createReport(out_file_path=tempfile.gettempdir(), 33 | studyAreas=[{"address":{"text":"380 New York St. Redlands, CA 92373"}}], 34 | studyAreasOptions={"areaType":"RingBuffer","bufferUnits":"esriMiles","bufferRadii":[1,2,3]}) 35 | print g.dataCollections(outFields=None, addDerivativeVariables=None) 36 | print g.dataCollections(outFields=None, addDerivativeVariables=None, countryName="Canada") 37 | print g.dataCollections(outFields=None, addDerivativeVariables=None, suppressNullValues=True) 38 | print g.standardGeographyQuery(sourceCountry="CA", 39 | geographyIDs=["35"], 40 | geographyLayers=["CAN.PR"]) 41 | print g.standardGeographyQuery(sourceCountry="US", 42 | geographyIDs=["92129", "92126"], 43 | geographyLayers=["US.ZIP5"], 44 | returnGeometry=True, 45 | returnCentroids=True) 46 | print g.standardGeographyQuery(sourceCountry="CA", 47 | geographyIDs=["35"], 48 | geographyLayers=["CAN.PR"], 49 | returnGeometry=True) 50 | print 'fin' 51 | -------------------------------------------------------------------------------- /tests/readme.txt: -------------------------------------------------------------------------------- 1 | This folder shows some testing used to debug and create functions. -------------------------------------------------------------------------------- /tests/security_tests.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | import unittest 3 | 4 | from arcrest.security import OAuthSecurityHandler 5 | 6 | 7 | class OAuthSecurityHandlerTests(unittest.TestCase): 8 | def test_get_token_with_invalid_client_id_should_not_return_valid_as_true(self): 9 | client_id = "invalid_client_id" 10 | secret_id = "invalid_secret" 11 | org_url = "https://www.arcgis.com" 12 | 13 | oauth_handler = OAuthSecurityHandler(client_id, secret_id, org_url) 14 | # Call .token to trigger token generation call 15 | self.assertIsNone(oauth_handler.token) 16 | self.assertNotEqual(True, oauth_handler.valid) 17 | 18 | def test_get_token_with_invalid_secret_id_should_not_return_valid_as_true(self): 19 | client_id = "IXlkCQ0nfEAKbZAP" 20 | secret_id = "invalid_secret" 21 | org_url = "https://www.arcgis.com" 22 | 23 | oauth_handler = OAuthSecurityHandler(client_id, secret_id, org_url) 24 | # Call .token to trigger token generation call 25 | self.assertIsNone(oauth_handler.token) 26 | self.assertNotEqual(True, oauth_handler.valid) 27 | -------------------------------------------------------------------------------- /tools/ArcRESTToolbox.tbx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Esri/ArcREST/ab240fde2b0200f61d4a5f6df033516e53f2f416/tools/ArcRESTToolbox.tbx -------------------------------------------------------------------------------- /tools/helpDocs/readme.txt: -------------------------------------------------------------------------------- 1 | Overview: 2 | Each tool in the toolboxes was developed using ArcREST. To get the tools working, download ArcREST and run the setup.py install from command line. 3 | The tool's help is outlined in each script. 4 | 5 | -------------------------------------------------------------------------------- /tools/src/addUserToGroup.py: -------------------------------------------------------------------------------- 1 | """ 2 | @author: ArcREST Team 3 | @contact: www.github.com/Esri/ArcREST 4 | @company: Esri 5 | @version: 1.0.0 6 | @description: 7 | @requirements: Python 2.7.x, ArcGIS 10.2.2, ArcREST 2.0 8 | @copyright: Esri, 2015 9 | """ 10 | import os 11 | from arcpy import env 12 | import arcpy 13 | import arcrest 14 | #-------------------------------------------------------------------------- 15 | class FunctionError(Exception): 16 | """ raised when a function fails to run """ 17 | pass 18 | #-------------------------------------------------------------------------- 19 | def trace(): 20 | """ 21 | trace finds the line, the filename 22 | and error message and returns it 23 | to the user 24 | """ 25 | import traceback 26 | import sys 27 | tb = sys.exc_info()[2] 28 | tbinfo = traceback.format_tb(tb)[0] 29 | # script name + line number 30 | line = tbinfo.split(", ")[1] 31 | # Get Python syntax error 32 | # 33 | synerror = traceback.format_exc().splitlines()[-1] 34 | return line, __file__, synerror 35 | 36 | #-------------------------------------------------------------------------- 37 | def main(*argv): 38 | """ main driver of program """ 39 | try: 40 | adminUsername = argv[0] 41 | adminPassword = argv[1] 42 | siteURL = argv[2] 43 | username = argv[3] 44 | groupName = argv[4] 45 | # Logic 46 | # 47 | # Connect to AGOL 48 | # 49 | sh = arcrest.AGOLTokenSecurityHandler(adminUsername, adminPassword) 50 | admin = arcrest.manageorg.Administration(securityHandler=sh) 51 | # Get the group ID 52 | # 53 | community = admin.community 54 | groupId = community.getGroupIDs(groupNames=[groupName])[0] 55 | # Add the User to the Group 56 | # 57 | groups = community.groups 58 | res = groups.group(groupId=groupId).addUsersToGroups(users=username) 59 | if len(res['notAdded'] ) == 0: 60 | arcpy.SetParameterAsText(5, True) 61 | else: 62 | arcpy.SetParameterAsText(5, False) 63 | except arcpy.ExecuteError: 64 | line, filename, synerror = trace() 65 | arcpy.AddError("error on line: %s" % line) 66 | arcpy.AddError("error in file name: %s" % filename) 67 | arcpy.AddError("with error message: %s" % synerror) 68 | arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) 69 | except FunctionError, f_e: 70 | messages = f_e.args[0] 71 | arcpy.AddError("error in function: %s" % messages["function"]) 72 | arcpy.AddError("error on line: %s" % messages["line"]) 73 | arcpy.AddError("error in file name: %s" % messages["filename"]) 74 | arcpy.AddError("with error message: %s" % messages["synerror"]) 75 | arcpy.AddError("ArcPy Error Message: %s" % messages["arc"]) 76 | except: 77 | line, filename, synerror = trace() 78 | arcpy.AddError("error on line: %s" % line) 79 | arcpy.AddError("error in file name: %s" % filename) 80 | arcpy.AddError("with error message: %s" % synerror) 81 | #-------------------------------------------------------------------------- 82 | if __name__ == "__main__": 83 | env.overwriteOutput = True 84 | argv = tuple(str(arcpy.GetParameterAsText(i)) 85 | for i in xrange(arcpy.GetArgumentCount())) 86 | main(*argv) -------------------------------------------------------------------------------- /tools/src/deleteGroup.py: -------------------------------------------------------------------------------- 1 | """ 2 | @author: ArcREST Team 3 | @contact: www.github.com/Esri/ArcREST 4 | @company: Esri 5 | @version: 1.0.0 6 | @description: deletes a group on the AGOL site. 7 | @requirements: Python 2.7.x, ArcGIS 10.2.2, ArcREST 2.0 8 | @copyright: Esri, 2015 9 | """ 10 | import os 11 | from arcpy import env 12 | from arcpy import mapping 13 | from arcpy import da 14 | import arcpy 15 | import ConfigParser 16 | import arcrest 17 | #-------------------------------------------------------------------------- 18 | class FunctionError(Exception): 19 | """ raised when a function fails to run """ 20 | pass 21 | #-------------------------------------------------------------------------- 22 | def trace(): 23 | """ 24 | trace finds the line, the filename 25 | and error message and returns it 26 | to the user 27 | """ 28 | import traceback 29 | import sys 30 | tb = sys.exc_info()[2] 31 | tbinfo = traceback.format_tb(tb)[0] 32 | # script name + line number 33 | line = tbinfo.split(", ")[1] 34 | # Get Python syntax error 35 | # 36 | synerror = traceback.format_exc().splitlines()[-1] 37 | return line, __file__, synerror 38 | #-------------------------------------------------------------------------- 39 | def main(*argv): 40 | """ main driver of program """ 41 | try: 42 | # Inputs 43 | # 44 | adminUsername = argv[0] 45 | adminPassword = argv[1] 46 | siteURL = argv[2] 47 | groupName = argv[3] 48 | # Logic 49 | # 50 | sh = arcrest.AGOLTokenSecurityHandler(adminUsername, adminPassword) 51 | admin = arcrest.manageorg.Administration(securityHandler=sh) 52 | community = admin.community 53 | g = community.getGroupIDs(groupNames=[groupName]) 54 | if len(g) == 0: 55 | arcpy.AddWarning("No Group Exists with That Name %s" % groupName) 56 | arcpy.SetParameterAsText(4, False) 57 | elif len(g) == 1: 58 | groups = community.groups 59 | groups.deleteGroup(groupId=g[0]) 60 | arcpy.AddWarning("%s was erased." % groupName) 61 | arcpy.SetParameterAsText(4, True) 62 | else: 63 | arcpy.AddError("Multiple group names found, please manually delete!") 64 | arcpy.SetParameterAsText(4, False) 65 | except arcpy.ExecuteError: 66 | line, filename, synerror = trace() 67 | arcpy.AddError("error on line: %s" % line) 68 | arcpy.AddError("error in file name: %s" % filename) 69 | arcpy.AddError("with error message: %s" % synerror) 70 | arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) 71 | except FunctionError, f_e: 72 | messages = f_e.args[0] 73 | arcpy.AddError("error in function: %s" % messages["function"]) 74 | arcpy.AddError("error on line: %s" % messages["line"]) 75 | arcpy.AddError("error in file name: %s" % messages["filename"]) 76 | arcpy.AddError("with error message: %s" % messages["synerror"]) 77 | arcpy.AddError("ArcPy Error Message: %s" % messages["arc"]) 78 | except: 79 | line, filename, synerror = trace() 80 | arcpy.AddError("error on line: %s" % line) 81 | arcpy.AddError("error in file name: %s" % filename) 82 | arcpy.AddError("with error message: %s" % synerror) 83 | #-------------------------------------------------------------------------- 84 | if __name__ == "__main__": 85 | env.overwriteOutput = True 86 | argv = tuple(str(arcpy.GetParameterAsText(i)) 87 | for i in xrange(arcpy.GetArgumentCount())) 88 | main(*argv) -------------------------------------------------------------------------------- /tools/src/deleteItem.py: -------------------------------------------------------------------------------- 1 | """ 2 | @author: ArcREST Team 3 | @contact: www.github.com/Esri/ArcREST 4 | @company: Esri 5 | @version: 1.0.0 6 | @description: deletes an item from AGOL 7 | @requirements: Python 2.7.x, ArcGIS 10.2.2, ArcREST 2.0 8 | @copyright: Esri, 2015 9 | """ 10 | from arcpy import env 11 | import arcpy 12 | import arcrest 13 | #-------------------------------------------------------------------------- 14 | class FunctionError(Exception): 15 | """ raised when a function fails to run """ 16 | pass 17 | #-------------------------------------------------------------------------- 18 | def trace(): 19 | """ 20 | trace finds the line, the filename 21 | and error message and returns it 22 | to the user 23 | """ 24 | import traceback 25 | import sys 26 | tb = sys.exc_info()[2] 27 | tbinfo = traceback.format_tb(tb)[0] 28 | # script name + line number 29 | line = tbinfo.split(", ")[1] 30 | # Get Python syntax error 31 | # 32 | synerror = traceback.format_exc().splitlines()[-1] 33 | return line, __file__, synerror 34 | #-------------------------------------------------------------------------- 35 | def main(*argv): 36 | """ main driver of program """ 37 | try: 38 | # Inputs 39 | # 40 | adminUsername = argv[0] 41 | adminPassword = argv[1] 42 | siteURL = argv[2] 43 | username = argv[3] 44 | itemId = argv[4] 45 | folderId = argv[5] 46 | # Logic 47 | # 48 | sh = arcrest.AGOLTokenSecurityHandler(adminUsername, adminPassword) 49 | admin = arcrest.manageorg.Administration(url=siteURL, 50 | securityHandler=sh) 51 | content = admin.content 52 | #if isinstance(content, arcrest.manageorg._content.Content): pass 53 | usercontent = content.usercontent(username=username) 54 | if folderId is None or \ 55 | folderId == "": 56 | res = usercontent.deleteItem(item_id=itemId) 57 | else: 58 | res = usercontent.deleteItem(item_id=itemId, folder=folderId) 59 | arcpy.SetParameterAsText(6, str(res)) 60 | except arcpy.ExecuteError: 61 | line, filename, synerror = trace() 62 | arcpy.AddError("error on line: %s" % line) 63 | arcpy.AddError("error in file name: %s" % filename) 64 | arcpy.AddError("with error message: %s" % synerror) 65 | arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) 66 | except FunctionError, f_e: 67 | messages = f_e.args[0] 68 | arcpy.AddError("error in function: %s" % messages["function"]) 69 | arcpy.AddError("error on line: %s" % messages["line"]) 70 | arcpy.AddError("error in file name: %s" % messages["filename"]) 71 | arcpy.AddError("with error message: %s" % messages["synerror"]) 72 | arcpy.AddError("ArcPy Error Message: %s" % messages["arc"]) 73 | except: 74 | line, filename, synerror = trace() 75 | arcpy.AddError("error on line: %s" % line) 76 | arcpy.AddError("error in file name: %s" % filename) 77 | arcpy.AddError("with error message: %s" % synerror) 78 | #-------------------------------------------------------------------------- 79 | if __name__ == "__main__": 80 | env.overwriteOutput = True 81 | argv = tuple(str(arcpy.GetParameterAsText(i)) 82 | for i in xrange(arcpy.GetArgumentCount())) 83 | main(*argv) -------------------------------------------------------------------------------- /tools/src/deleteUser.py: -------------------------------------------------------------------------------- 1 | """ 2 | @author: ArcREST Team 3 | @contact: www.github.com/Esri/ArcREST 4 | @company: Esri 5 | @version: 1.0.0 6 | @description: 7 | @requirements: Python 2.7.x, ArcGIS 10.2.2, ArcREST 2.0 8 | @copyright: Esri, 2015 9 | """ 10 | import os 11 | from arcpy import env 12 | from arcpy import mapping 13 | from arcpy import da 14 | import arcpy 15 | import arcrest 16 | #-------------------------------------------------------------------------- 17 | class FunctionError(Exception): 18 | """ raised when a function fails to run """ 19 | pass 20 | #-------------------------------------------------------------------------- 21 | def trace(): 22 | """ 23 | trace finds the line, the filename 24 | and error message and returns it 25 | to the user 26 | """ 27 | import traceback 28 | import sys 29 | tb = sys.exc_info()[2] 30 | tbinfo = traceback.format_tb(tb)[0] 31 | # script name + line number 32 | line = tbinfo.split(", ")[1] 33 | # Get Python syntax error 34 | # 35 | synerror = traceback.format_exc().splitlines()[-1] 36 | return line, __file__, synerror 37 | #-------------------------------------------------------------------------- 38 | def main(*argv): 39 | """ main driver of program """ 40 | try: 41 | adminUsername = argv[0] 42 | adminPassword = argv[1] 43 | siteURL = argv[2] 44 | deleteUser = argv[3] 45 | # Logic 46 | # 47 | sh = arcrest.AGOLTokenSecurityHandler(adminUsername, adminPassword) 48 | admin = arcrest.manageorg.Administration(securityHandler=sh) 49 | community = admin.community 50 | user = community.user 51 | res = user.deleteUser(username=deleteUser) 52 | if res.has_key('success'): 53 | arcpy.SetParameterAsText(4, str(res['success']).lower() == "true") 54 | else: 55 | arcpy.SetParameterAsText(4, False) 56 | del sh 57 | del admin 58 | del community 59 | del user 60 | del res 61 | except arcpy.ExecuteError: 62 | line, filename, synerror = trace() 63 | arcpy.AddError("error on line: %s" % line) 64 | arcpy.AddError("error in file name: %s" % filename) 65 | arcpy.AddError("with error message: %s" % synerror) 66 | arcpy.AddError("ArcPy Error Message: %s" % arcpy.GetMessages(2)) 67 | except FunctionError, f_e: 68 | messages = f_e.args[0] 69 | arcpy.AddError("error in function: %s" % messages["function"]) 70 | arcpy.AddError("error on line: %s" % messages["line"]) 71 | arcpy.AddError("error in file name: %s" % messages["filename"]) 72 | arcpy.AddError("with error message: %s" % messages["synerror"]) 73 | arcpy.AddError("ArcPy Error Message: %s" % messages["arc"]) 74 | except: 75 | line, filename, synerror = trace() 76 | arcpy.AddError("error on line: %s" % line) 77 | arcpy.AddError("error in file name: %s" % filename) 78 | arcpy.AddError("with error message: %s" % synerror) 79 | #-------------------------------------------------------------------------- 80 | if __name__ == "__main__": 81 | env.overwriteOutput = True 82 | argv = tuple(str(arcpy.GetParameterAsText(i)) 83 | for i in xrange(arcpy.GetArgumentCount())) 84 | main(*argv) -------------------------------------------------------------------------------- /unittests/empty.txt: -------------------------------------------------------------------------------- 1 | unit tests go here. --------------------------------------------------------------------------------