Welcome, guest | Sign In | My Account | Store | Cart

Notice! PyPM is being replaced with the ActiveState Platform, which enhances PyPM’s build and deploy capabilities. Create your free Platform account to download ActivePython or customize Python with the packages you require and get automatic updates.


TGWebServices is unavailable in PyPM, because there aren't any builds for it in the package repositories. Click the linked icons to find out why.

 Python 2.7Python 3.2Python 3.3
Windows (32-bit)
2.0.0a1 Failed View build log
Windows (64-bit)
2.0.0a1 Failed View build log
Mac OS X (10.5+)
2.0.0a1 Failed View build log
Linux (32-bit)
2.0.0a1 Failed View build log
Linux (64-bit)
2.0.0a1 Failed View build log
Lastest release
version 2.0.0a1 on Jan 5th, 2011

TurboGears gives you a plain HTTP with JSON return values API for your application for free. This isn't always what you want, though. Sometimes, you don't want to expose all of the data to the web that you need to render your templates. Maybe you need to support a protocol that names the function it's calling as part of what it POSTs such as SOAP or XML-RPC.

TGWebServices provides a super simple API for creating web services that are available via SOAP, HTTP->XML, and HTTP->JSON. The SOAP API generates WSDL automatically for your Python and even generates enough type information for statically typed languages (Java and C#, for example) to generate good client code on their end.

How easy is it?

System Message: WARNING/2 (<string>, line 18)

Literal block expected; none found.

class Multiplier(WebServicesRoot):

@wsexpose(int) @wsvalidate(int, int) def multiply(self, num1, num2): return num1 * num2

With this at the root, SOAP clients can find the WSDL file at /soap/api.wsdl and POST SOAP requests to /soap/. HTTP requests to /multiply?num1=5&num2=20 will return an XML document with the result of 100. Add ?tg_format=json (or an HTTP Accept: text/javascript header) and you'll get JSON back.

The great thing about this is that the code above looks like a '''normal Python function''' and doesn't know a thing about web services.


  • Easiest way to expose a web services API
  • Outputs wrapped document/literal SOAP, which is the most widely

System Message: WARNING/2 (<string>, line 39)

Bullet list ends without a blank line; unexpected unindent.

compatible format * Provides enough type information for statically typed languages to generate conveniently usable interfaces * Can output instances of your own classes * Can also accept instances of your classes as input * Works with TurboGears 1.0 * MIT license allows for unrestricted use

Subscribe to package updates

Last updated Jan 5th, 2011

What does the lock icon mean?

Builds marked with a lock icon are only available via PyPM to users with a current ActivePython Business Edition subscription.

Need custom builds or support?

ActivePython Enterprise Edition guarantees priority access to technical support, indemnification, expert consulting and quality-assured language builds.

Plan on re-distributing ActivePython?

Get re-distribution rights and eliminate legal risks with ActivePython OEM Edition.