Skip to main content

Provides classes that can edit ArcGIS service configuration as either running services (ArcGIS Server Admin JSON format) or Service Definition Drafts.

Project description

agsconfig · GitHub Build Status

agsconfig is a Python library for editing ArcGIS Server service configuration, either before deployment by editing a Service Definition Draft file (generated by either ArcMap, ArcGIS Pro, or via arcpy), or after deployment by editing the JSON configuration provided by ArcGIS Server (via the ArcGIS Server REST Admin API).

This helps to programmatically configure services as part of automated service deployment or configuration patching processes.

Installation

agsconfig is made available on PyPi, simply install it with pip.

> pip install agsconfig

Usage

agsconfig contains many classes to alter the configuration of different service types. However, it is not recommended these classes be instantiated directly. Helper functions are available in the top-level module to load different types of services with either Service Defintion Draft based configuration, or ArcGIS Server JSON configuration. These functions are:

  • agsconfig.load_image_sddraft
  • agsconfig.load_image_service
  • agsconfig.load_map_sddraft
  • agsconfig.load_map_service
  • agsconfig.load_vector_tile_sddraft
  • agsconfig.load_vector_tile_service

Each function expects one or more file or file-like objects to be passed in. For functions dealing with Service Definition Drafts, only one file-like object is required. For ArcGIS Server JSON based functions, two are required, the first being the main service JSON, and the second being the ItemInfo JSON. Each file should be opened in binary mode, and with write enabled if you wish to save the changes (as opposed to just reading settings). Save changes seeks the file-like object back to the beginning and overwrites the stream.

Example: Load/Save a MapServer Service Definiton Draft

import agsconfig

sddraft_path = "path/to/MyService.sddraft"

with open(sddraft_path, mode="rb+") as sddraft:
    map_service = agsconfig.load_map_sddraft(sddraft)

    # Edit your map service configuration
    map_service.capabilities = [agsconfig.MapServer.Capability.map]
    map_service.min_instances = 3
    map_service.max_instances = 6
    map_service.summary = "This is my awesome map service."
    map_service.kml_server.enabled = True

    # Save configuration changes
    map_service.save()

Development

To get started on developing agsconfig, simply fork the repository and get it with your favourite Git client. In the root of the repository is a standalone task runner, pie.py, that can excute tasks contained in pie_tasks.py.

You'll need a Python install with pip and virtualenv, but other than that, no pre-installed dependencies are necessary.

On a shell, simply run the setup task as follows to create a virtual environment for development work:

> python .\pie.py setup

To get a list of all available tasks, exceute the following:

> python .\pie.py -l

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agsconfig-0.1.31-py2.py3-none-any.whl (53.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file agsconfig-0.1.31-py2.py3-none-any.whl.

File metadata

  • Download URL: agsconfig-0.1.31-py2.py3-none-any.whl
  • Upload date:
  • Size: 53.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/2.7.16

File hashes

Hashes for agsconfig-0.1.31-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 44d2a4e7ab19afd47dc4ba31c55b39637f970f551133a8c48632304cf3463098
MD5 cee756f8d35a7c9e9a364ab38a7b5b64
BLAKE2b-256 38d9a3b689731f355ce7823817bc37e2df92f47f4f38e17be9bc26d78e53648d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page