# Name: GenerateIntersections_Pro_ex3_fs.py
# Description: Generates and updates intersections in an existing feature service.
# Requires: ArcGIS Location Referencing
# Import arcpy module
import arcpy
# Local variables
in_intersection_feature_class = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/1"
in_network_layer = r"https://yourdomain.com/server/rest/services/FeatureServiceName/FeatureServer/1"
Input LRS route network is in feature service. Signing in portal is required to access the feature service.
arcpy.SignInToPortal('https://yourdomain.com/portal', 'username', 'password')
# Check out license
arcpy.CheckOutExtension("LocationReferencing"
# Execute the tool
arcpy.locref.GenerateIntersections(in_intersection_feature_class, in_network_layer, "5/5/2020", "CURRENT_USER")
# Check in license
arcpy.CheckInExtension('LocationReferencing')