This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gentoken(username, password, referer, expiration=60): | |
#Re-usable function to get a token required for Admin changes | |
referer = "http://www.arcgis.com/" | |
query_dict = {'username': username, | |
'password': password, | |
'expiration': str(expiration), | |
'client': 'referer', | |
'referer': referer, | |
'f': 'json'} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sendEmail(content, images): | |
import smtplib | |
from email.mime.multipart import MIMEMultipart | |
from email.mime.text import MIMEText | |
from email.mime.image import MIMEImage | |
FROM = '[email protected]' | |
TO = '[email protected]' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import system modules | |
import urllib, urllib2, json | |
import sys, os | |
import requests | |
import arcpy | |
import ConfigParser | |
from xml.etree import ElementTree as ET | |
def urlopen(url, data=None): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib.parse as parse | |
import urllib.request as request | |
import http.client as client | |
#Force connections to the previous HTTP 1.0 standard as this is faster with chunked responses, which is typically what you'll get | |
client.HTTPConnection._http_vsn= 10 | |
client.HTTPConnection._http_vsn_str='HTTP/1.0' | |
def sendReq(url, qDict=None, headers=None): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------------- | |
# Name: UploadPublishCSVMultipart | |
# Purpose: This script uploads and publishes a CSV that includes XY data, not | |
# addresses. This uses a multipart upload for the CSV and requires | |
# username, password, CSVfile, X and Y fields, and tags to be defined | |
# Author: Melanie Summers | |
import requests | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from arcgis.gis import GIS | |
import requests | |
import json | |
USER = "USER" | |
PASS = "PASSWORD" | |
g = GIS("https://www.arcgis.com", USER, PASS) | |
token = g._con.token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from arcgis.gis import GIS | |
import requests | |
import json | |
import getpass | |
USER = "USERNAME" | |
PASS = getpass.getpass() | |
g = GIS("https://ORG.maps.arcgis.com", USER, PASS) |