Skip to main content

Use the TeamCity REST API from Python

Project description

PyTeamCity

Latest Version Travis CI Build Status AppVeyor Build Status Coveralls Coverage Status

Python interface to the REST API of TeamCity

Installation

pip install pyteamcity

New API work-in-progress

Note that I am working on a new API currently called pyteamcity.future (initially added in #37).

Goal here is to create a brand new API that is much more flexible and to have nicer code that is easier to work with. The old code encourages adding a zillion methods for different ways of filtering. The new code has an API with a smaller number of methods that are more consistent and more flexible in terms of filtering. It is modeled after the Django ORM API.

There’s no formal docs for this API yet, but you should be able to figure out how to use it by looking at the unit tests.

I am probably not going to merge PRs that add things to the old API, because I see the new API as the future. I of course am very interested in PRs that add things to the new API!

Examples

Connect to server

from pyteamcity import TeamCity

# This initialises the Client with the settings passed. <port> has to be an integer.
tc = TeamCity('account', 'password', 'server', <port>)

or specify no parameters and it will read settings from environment variables:

  • TEAMCITY_USER

  • TEAMCITY_PASSWORD

  • TEAMCITY_HOST

  • TEAMCITY_PORT (Defaults to 80 if not set)

from pyteamcity import TeamCity

# Initialises with environment variables: TEAMCITY_{USER,PASSWORD,HOST,PORT}
tc = TeamCity()

Getting data

tc.get_projects()
tc.get_project_by_project_id('MyProject')
tc.get_all_users()
tc.get_user_by_username('codyw')
tc.get_all_vcs_roots()
tc.get_all_build_types()
tc.get_changes_by_build_id(73450)
tc.get_build_statistics_by_build_id(73450)
tc.get_build_tags_by_build_id(73450)
tc.get_all_changes()
tc.get_change_by_change_id(16884)
tc.get_all_builds(start=0, count=3)
tc.get_build_by_build_id(73450)
tc.get_server_info()
tc.get_agents()
tc.get_all_plugins()

You can also look at sample.py or test_legacy.py

Acknowledgements

This is a heavily-modified fork of https://github.com/yotamoron/teamcity-python-rest-client so many thanks are due to Yotam Oron

Changes

0.1.1 (2016-11-09)

Unreleased

Project details


Download files

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

Source Distribution

pyteamcity-0.1.1.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

pyteamcity-0.1.1-py2-none-any.whl (12.5 kB view details)

Uploaded Python 2

File details

Details for the file pyteamcity-0.1.1.tar.gz.

File metadata

  • Download URL: pyteamcity-0.1.1.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pyteamcity-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3d9f97fff7f397f2c2484acd5acda7bb48681ec1ff9ed80443a7c374613b0fe1
MD5 7aa97fd86a151d3243ed1e31f79852cd
BLAKE2b-256 075b18104c49d8bb77a8f4ddd80822b223edbbd8e49ffcf539018b686b6b6e4f

See more details on using hashes here.

File details

Details for the file pyteamcity-0.1.1-py2-none-any.whl.

File metadata

File hashes

Hashes for pyteamcity-0.1.1-py2-none-any.whl
Algorithm Hash digest
SHA256 43a5c91e62590259321dec37cfd0dc297905e92d9d2026030a016acf3d0e8cf7
MD5 df1d124c1bbddb3af017cbae5ae657bd
BLAKE2b-256 f3ccc4e598e5c1a9250ec7088c239732bb4ac195f0439336f6b55389286f179e

See more details on using hashes here.

Supported by

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