How to use Rest APi to get Teamcity information

I am relatively new to Teamcity. I have created a project and configurations, run builds, etc. For a release, I need to create a report to send out, (for one project), I want to list all the configurations, the last build #, and the url for each configuration, to a report. What is the best way of doing this (they use Ant and Python here). Can someone give me (or point me to), an example of this (using the Rest API?). How to get the info, and then how to export this to a report\txt file. Basically, I am looking for the script example to do this.  Please do not just point me to the teamcity rest documentation, I don't understand how to apply it in a script file.  Do I need addition tools like curl, etc.?
Who is Participating?
Walter RitzelConnect With a Mentor Senior Software EngineerCommented:
I am not familiar with Teamcity REST API, but in generic way REST API is just a bunch of URLs. You do GET or POST requests to these URLs to query info from them (URL itself specifies the item) and save result to variable.

The best library to do HTTP requests in Python is
eelouAuthor Commented:
The links above were helpful.  The problem that I ran into was the user\password.  This is what we came up with...

# coding=utf8

import urllib.request
import base64
import xml.etree.ElementTree as ET

base64auth = base64.b64encode("{0}:{1}".format("username", "password").encode("ascii")).decode("ascii").replace("\n","")

#put real ip address below
url = ""
request = urllib.request.Request(url)
request.add_header("Authorization", "Basic {0}".format(base64auth))
response = urllib.request.urlopen(request)
Configurations = ET.fromstring('utf-8'))

for config in Configurations.findall('buildType'):
      print ('{0},{1}'.format(config.attrib['name'],"  " + config.attrib['id']))
All Courses

From novice to tech pro — start learning today.