Skip to content

Instantly share code, notes, and snippets.



Last active Dec 17, 2015
What would you like to do?
automated soe updating
<Project DefaultTargets="UpdateSOE" ...>
<Target Name="UpdateSOE" DependsOnTargets="Build">
<!-- Python needs to be in the path -->
<Exec Command="python $(MSBuildProjectDirectory)\PostBuildEvents\"/>
import requests
token_url = "http://localhost:6080/arcgis/admin/generateToken"
update_soe_url = "http://localhost:6080/arcgis/admin/services/types/extensions/update"
upload_url = "http://localhost:6080/arcgis/admin/uploads/upload?token={}"
#: Enhancement: pass in as a build arguement
file_name = r'C:\*.soe'
data = {'username': "",
'password': "",
'client': 'requestip',
'f': 'json'}
r =, data=data)
print 'got token'
files = {'itemFile': open(file_name, 'rb'), 'f': 'json'}
data['token'] = token = r.json()['token']
print 'uploading'
r =, files=files)
print r.status_code, r.text
data['id'] = r.json()["item"]["itemID"]
print data['id']
files = {'file': open(file_name, 'rb')}
print 'updating'
r =, params=data)
print r.status_code, r.text
print 'done'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment