Skip to main content

RESTAPI Client for the ZANATA translation web-service

Project description

pyzanata

Alternative Zanata restapi client.

Usage

In order to get started two imports are needed:

from pyzanata import ZanataCredentials
from pyzanata import ZanataClient

First credentials needs to be set:

credentials = ZanataCredentials('http://zanata.example.com/rest/', 'johndoe', 'secret-token')

Then the client can be initialized:

client = ZanataClient(credentials)

Now Zanata infos can be fetched (or set) like so:

client.ProjectsResource.projects.GET()
client.ProjectResource.project.GET(projectSlug='myproject')

It has always the form client.RESOURCE.ENDPOINT.METHOD(data=None, **path_replacements).

RESOURCE

name of the resource according the the declaration (first level).

ENDPOINT

name of the endpoint according the the declaration (second level).

METHOD

one of the http-methods (depends on endpint, as configured in declaration)

data

payload passed to body of requests call.

params

payload passed to query string of requests call.

path_replacements

keyword arguments used to replace the dynamic path elements as configured in the declaration.

Consult the Zanata REST API Documentation for details. Deprecated APIs are not implemented.

See also the Declaration YAML File (GitHub). This file is read by the generic API runtime code and declares the API.

An application using this code can be found at collective.ttwpo Plone Addon.

Contribute

Support

If you are having issues, please let me know: jens@bluedynamics.com

License

Copyright (c) 2017, BlueDynamics Alliance, Austria, Germany, Switzerland All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of the BlueDynamics Alliance nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY BlueDynamics Alliance AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BlueDynamics Alliance BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

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

pyzanata-1.0b1.tar.gz (6.4 kB view hashes)

Uploaded Source

Built Distribution

pyzanata-1.0b1-py2-none-any.whl (8.9 kB view hashes)

Uploaded Python 2

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