agsconfig


Nameagsconfig JSON
Version 0.3.4 PyPI version JSON
download
home_pagehttps://github.com/DavidWhittingham/agsconfig
SummaryProvides classes that can edit ArcGIS service configuration as either running services (ArcGIS Server Admin JSON format) or Service Definition Drafts.
upload_time2024-04-26 06:00:04
maintainerNone
docs_urlNone
authorDavid Whittingham; Chris Blanchfield; Gary Bagnall
requires_pythonNone
licenseBSD 3-Clause
keywords arcgis esri
VCS
bugtrack_url
requirements aenum future html2text html2text jsonpath-ng lxml tzlocal tzlocal
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # agsconfig · [![GitHub](https://img.shields.io/badge/license-BSD--3--Clause-brightgreen.svg)](LICENSE)

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

```python
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`](https://github.com/adamkerz/pie), 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
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/DavidWhittingham/agsconfig",
    "name": "agsconfig",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "arcgis esri",
    "author": "David Whittingham; Chris Blanchfield; Gary Bagnall",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "# agsconfig · [![GitHub](https://img.shields.io/badge/license-BSD--3--Clause-brightgreen.svg)](LICENSE)\n\nagsconfig 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).\n\nThis helps to programmatically configure services as part of automated service deployment or configuration patching processes.\n\n## Installation\n\nagsconfig is made available on PyPi, simply install it with `pip`.\n\n```\n> pip install agsconfig\n```\n\n## Usage\n\nagsconfig 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:\n\n- agsconfig.load_image_sddraft\n- agsconfig.load_image_service\n- agsconfig.load_map_sddraft\n- agsconfig.load_map_service\n- agsconfig.load_vector_tile_sddraft\n- agsconfig.load_vector_tile_service\n\nEach 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.\n\n### Example: Load/Save a MapServer Service Definiton Draft\n\n```python\nimport agsconfig\n\nsddraft_path = \"path/to/MyService.sddraft\"\n\nwith open(sddraft_path, mode=\"rb+\") as sddraft:\n    map_service = agsconfig.load_map_sddraft(sddraft)\n\n    # Edit your map service configuration\n    map_service.capabilities = [agsconfig.MapServer.Capability.map]\n    map_service.min_instances = 3\n    map_service.max_instances = 6\n    map_service.summary = \"This is my awesome map service.\"\n    map_service.kml_server.enabled = True\n\n    # Save configuration changes\n    map_service.save()\n```\n\n## Development\n\nTo 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`](https://github.com/adamkerz/pie), that can excute tasks contained in `pie_tasks.py`.\n\nYou'll need a Python install with `pip` and `virtualenv`, but other than that, no pre-installed dependencies are necessary.\n\nOn a shell, simply run the setup task as follows to create a virtual environment for development work:\n\n```\n> python .\\pie.py setup\n```\n\nTo get a list of all available tasks, exceute the following:\n\n```\n> python .\\pie.py -l\n```\n",
    "bugtrack_url": null,
    "license": "BSD 3-Clause",
    "summary": "Provides classes that can edit ArcGIS service configuration as either running services (ArcGIS Server Admin JSON format) or Service Definition Drafts.",
    "version": "0.3.4",
    "project_urls": {
        "Homepage": "https://github.com/DavidWhittingham/agsconfig"
    },
    "split_keywords": [
        "arcgis",
        "esri"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cbe8b05a0e020bc9a804cf23e1478eb858e21911c5e68bba56cb5e1d91631849",
                "md5": "b9bced7e4384f49f43ec6dc5706a7d3e",
                "sha256": "924472a89b6f25bdb78d1f1b23fdb125fff84f2fecafc759cd471a722f8bc6ed"
            },
            "downloads": -1,
            "filename": "agsconfig-0.3.4-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b9bced7e4384f49f43ec6dc5706a7d3e",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 62146,
            "upload_time": "2024-04-26T06:00:04",
            "upload_time_iso_8601": "2024-04-26T06:00:04.622732Z",
            "url": "https://files.pythonhosted.org/packages/cb/e8/b05a0e020bc9a804cf23e1478eb858e21911c5e68bba56cb5e1d91631849/agsconfig-0.3.4-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-26 06:00:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "DavidWhittingham",
    "github_project": "agsconfig",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "aenum",
            "specs": [
                [
                    "<",
                    "4"
                ],
                [
                    ">=",
                    "3.1.5"
                ]
            ]
        },
        {
            "name": "future",
            "specs": [
                [
                    ">=",
                    "0.16.0"
                ]
            ]
        },
        {
            "name": "html2text",
            "specs": [
                [
                    "==",
                    "2019.8.11"
                ]
            ]
        },
        {
            "name": "html2text",
            "specs": [
                [
                    ">=",
                    "2019.8.11"
                ]
            ]
        },
        {
            "name": "jsonpath-ng",
            "specs": [
                [
                    "<",
                    "2"
                ],
                [
                    ">=",
                    "1.4.3"
                ]
            ]
        },
        {
            "name": "lxml",
            "specs": [
                [
                    ">=",
                    "4.3.2"
                ],
                [
                    "<",
                    "5"
                ]
            ]
        },
        {
            "name": "tzlocal",
            "specs": [
                [
                    "<",
                    "3"
                ],
                [
                    ">=",
                    "2.0.0"
                ]
            ]
        },
        {
            "name": "tzlocal",
            "specs": [
                [
                    "<",
                    "6"
                ],
                [
                    ">=",
                    "3.0.0"
                ]
            ]
        }
    ],
    "lcname": "agsconfig"
}
        
Elapsed time: 9.18409s