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?
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.
A more complete documentation can be found at http://wiki.tgws.googlecode.com/hg/index.html.
Features
Easiest way to expose a web services API
Supports SOAP, HTTP+XML, HTTP+JSON
Outputs wrapped document/literal SOAP, which is the most widely 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 and 1.1
MIT license allows for unrestricted use
Release files for TGWebServices 1.2.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| TGWebServices-1.2.4.tar.gz | 20.1 kB | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| TGWebServices-1.2.4-py2.6.egg | Legacy Egg format | - | - | Details |
| TGWebServices-1.2.4-py2.5.egg | Legacy Egg format | - | - | Details |
Total release size: 156.4 kB
Release files / TGWebServices-1.2.4.tar.gz
| Download URL | TGWebServices-1.2.4.tar.gz |
|---|---|
| Size | 20.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
09a9309b355b2521e16bcfd90eaec6178c2829c31da2c5a26db6ffa544ad8507
|
|
BLAKE2b-256 checksum How to use checksums |
c9abf88f39bc653c16f8718ac895e7d9cf7457d627f5c293fd66761d4b14f82e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / TGWebServices-1.2.4-py2.6.egg
| Download URL | TGWebServices-1.2.4-py2.6.egg |
|---|---|
| Size | 68.1 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
c62bdf1ee7999239fe52cf7de4226f1cb6614b64204f34560b48aae0455820f4
|
|
BLAKE2b-256 checksum How to use checksums |
ed92eedb97256ed9cbc4e890984278e71815619a1635247ac3b7f89ab0a75efc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / TGWebServices-1.2.4-py2.5.egg
| Download URL | TGWebServices-1.2.4-py2.5.egg |
|---|---|
| Size | 68.2 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
59e9bd63b7f205b77f8ab53722c6df7a1365843bc3ea1480741b7b5374df6688
|
|
BLAKE2b-256 checksum How to use checksums |
500826dc4f8ef3556d4bca2b7de39e773a844d1eb60e4d83256de62d3cfe5a38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |