Skip to main content

agsconfig · GitHub

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

Metadata

Release files for agsconfig 0.3.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for agsconfig 0.3.4
File Interpreter ABI Platform Actions
agsconfig-0.3.4-py2.py3-none-any.whl Python 3, Python 2 none any Details for agsconfig-0.3.4-py2.py3-none-any.whl

Release files / agsconfig-0.3.4-py2.py3-none-any.whl

Download URL agsconfig-0.3.4-py2.py3-none-any.whl
Size 62.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
924472a89b6f25bdb78d1f1b23fdb125fff84f2fecafc759cd471a722f8bc6ed
BLAKE2b-256 checksum
How to use checksums
cbe8b05a0e020bc9a804cf23e1478eb858e21911c5e68bba56cb5e1d91631849
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.11

Security for agsconfig 0.3.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.4 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page