.. image:: https://img.shields.io/pypi/v/tomcatmanager?label=latest%20version :target: https://pypi.python.org/pypi/tomcatmanager :alt: latest version .. image:: https://img.shields.io/pypi/pyversions/tomcatmanager :target: https://pypi.python.org/pypi/tomcatmanager :alt: supported python versions .. image:: https://img.shields.io/badge/license-MIT-orange :target: https://github.com/tomcatmanager/tomcatmanager/blob/main/LICENSE :alt: license .. image:: https://img.shields.io/github/workflow/status/tomcatmanager/tomcatmanager/Quick%20Test/main?label=build%20%28main%29 :target: https://github.com/tomcatmanager/tomcatmanager/tree/main :alt: main branch build status .. image:: https://img.shields.io/github/workflow/status/tomcatmanager/tomcatmanager/Quick%20Test/develop?label=build%20%28develop%29 :target: https://github.com/tomcatmanager/tomcatmanager/tree/develop :alt: develop branch build status .. image:: https://img.shields.io/codecov/c/github/tomcatmanager/tomcatmanager/main?token=3YbxJ1PKwJ :target: https://codecov.io/gh/tomcatmanager/tomcatmanager :alt: code coverage .. image:: https://img.shields.io/badge/code%20style-black-000000 :target: https://github.com/psf/black :alt: code style black .. image:: https://img.shields.io/github/workflow/status/tomcatmanager/tomcatmanager/Docs%20Test/main?label=docs%20%28main%29 :target: http://tomcatmanager.readthedocs.io/en/stable :alt: main branch documentation status .. image:: https://img.shields.io/github/workflow/status/tomcatmanager/tomcatmanager/Quick%20Test/develop?label=docs%20%28develop%29 :target: https://tomcatmanager.readthedocs.io/en/develop/ :alt: develop branch documentation status
If you use Apache Tomcat for any sort of development work you’ve probably deployed lots of applications to it. There are a several ways to get your war files deployed:
Tomcat Manager <https://tomcat.apache.org/tomcat-9.0-doc/manager-howto.html>_ application in your browser
Tomcat Ant Tasks <https://cwiki.apache.org/confluence/display/tomcat/AntDeploy>_ included with Tomcat
Cargo <https://codehaus-cargo.github.io/>_ and its plugins for ant and maven
Here's another way: a command line tool and python library for managing a Tomcat server.
This package installs a command line utility called
easily scriptable using your favorite shell:
$ tomcat-manager --user=ace --password=newenglandclamchowder
http://localhost:8080/manager deploy local sample.war /sampleapp $ echo $? 0
There is also an interactive mode:
/ running 0 ROOT /sampleapp stopped 0 sampleapp##9 /sampleapp running 0 sampleapp##8 /host-manager running 0 /usr/share/tomcat8-admin/host-manage /manager running 0 /usr/share/tomcat8-admin/manager
And for the ultimate in flexibility, you can use the python package directly:
.. code-block:: python
import tomcatmanager as tm tomcat = tm.TomcatManager() r = tomcat.connect(url="http://localhost:8080/manager", ... user="ace", password="newenglandclamchowder") tomcat.is_connected True r = tomcat.stop("/someapp") r.ok False r.status_message 'No context exists named /someapp'
Tomcatmanager has the following capabilities, all available from the command line, interactive mode, and as a python library:
Complete documentation for the last released version is available at
<http://tomcatmanager.readthedocs.io/en/stable/>_. It includes material
showing how to use
tomcat-manager from the command line or using
interactive mode. There is also a walkthrough of how to use the API and an
Documentation is also built from the
develop <https://github.com/tomcatmanager/tomcatmanager/tree/develop>_ branch, and
<https://tomcatmanager.readthedocs.io/en/latest/>_. The develop
branch may not yet be released to PyPi, but you can see the documentation for what's
coming up in the next release.
You'll need Python >= 3.7. Install using pip:
$ pip install tomcatmanager
Works on Windows, macOS, and Linux.
Works with Tomcat >= 8 and <= 10.
This library and associated tools do their work via the Tomcat Manager
web application included in the Tomcat distribution. You will need to
configure authentication in
tomcat-users.xml with access to the
.. code-block:: xml