Skip to main content

Multiprotocol Web Services for TurboGears

Project description

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.

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

  • Works with TurboGears 1.0

  • MIT license allows for unrestricted use

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

TGWebServices-1.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

TGWebServices-1.0-py2.4.egg (45.6 kB view details)

Uploaded Source

File details

Details for the file TGWebServices-1.0.tar.gz.

File metadata

  • Download URL: TGWebServices-1.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for TGWebServices-1.0.tar.gz
Algorithm Hash digest
SHA256 c49fcdcb7e7859680a2ac06b49a9d7f8ab34a48d55295449b4dd1b6175ef9d88
MD5 187a66f1cbc3c3905f7b3e7c8dc9b7e9
BLAKE2b-256 311690571a7abb429a9783846ffc74f32865892c13ffa4ae3bb725650fa201d2

See more details on using hashes here.

File details

Details for the file TGWebServices-1.0-py2.4.egg.

File metadata

File hashes

Hashes for TGWebServices-1.0-py2.4.egg
Algorithm Hash digest
SHA256 c20721e8c4f0d7d25e349f5e8bd8d60c28b008cc68494b915bb19d1b544dd630
MD5 3ec2818a046842e86f3583fdfd241098
BLAKE2b-256 dc3dd385293d0d85f576e9701260ab033029692135d5a2f3814acc86d7ab6b83

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