Skip to content

Instantly share code, notes, and snippets.

View josh-herman's full-sized avatar

Josh Herman josh-herman

View GitHub Profile
import requests
import csv
import urllib3
import argparse
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
parser = argparse.ArgumentParser(
description="Reads CSV, applies metric registry updates, resets all metrics based on new values."
)
"""Script to register ArcGIS Monitor Agent with ArcGIS Monitor Server"""
import argparse
import socket
import sys
import requests
def generate_monitor_token(monitor_url, username, password, verify_certs=True):
"""Generates a token for ArcGIS Monitor"""
url = f"{monitor_url}/auth/token"
@josh-herman
josh-herman / oauth2.py
Created December 27, 2022 15:55
ArcGIS Oauth2 'client_credentials' Python Example
import requests
def get_access_token():
# Generate an access token using the client ID and client secret from the registered app.
url = f"{portal_url}/sharing/rest/oauth2/token"
params = {
"f": "json",
"grant_type": "client_credentials",
@josh-herman
josh-herman / batch_geocode.py
Created December 21, 2022 14:33
ArcGIS Python API - Batch Geocode Example
from arcgis import GIS
from arcgis.geocoding import batch_geocode, get_geocoders
# Parameters
url = "https://machine.domain.com/webadaptorname"
username = "portalusername"
password = "portalpassword"
# Data
data = [

Basic Express Project Setup

  1. Start a new Node project by issuing...
npm init

...with these parameters:

{
  "name": "<projectName>",
 "version": "1.0.0",