Skip to content

Instantly share code, notes, and snippets.

@TheBryanMac
Created August 23, 2017 02:48
Show Gist options
  • Save TheBryanMac/5b1ce71944bfff66fa3f88a1b8929a1c to your computer and use it in GitHub Desktop.
Save TheBryanMac/5b1ce71944bfff66fa3f88a1b8929a1c to your computer and use it in GitHub Desktop.
Python script to generate a token from ArcGIS Server for use with secure map services
#Name: Generate a token from ArcGIS Server using python
#Author: Bryan McIntosh
#Description: Python script to generate a token from ArcGIS Server for use with secure map services.
# This sample uses the 'requests' module (https://pypi.python.org/pypi/requests/2.7.0)
import requests
params = {'username': 'USERNAME', 'password': 'PASSWORD', 'client': 'requestip', 'f': 'json'}
request = requests.post('https://YOUR.SITE.com/arcgis/tokens',params=params)
response = request.json()
myToken = response["token"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment