Skip to main content

SDK for Powerling API

Project description

Powerling API SDK

Installation

From sources

git clone <url> power-api-sdk
cd power-api-sdk
pip install .

From test pypi

pip install -i https://test.pypi.org/simple/ powerling-api-sdk-package-powerling

Usage

Initialization

from powerlingapi import PowerlingApi
from powerlingapi import exceptions

def main():
  api = PowerlingApi()

  try:
    api.authorize("YOUR-ACCESS-TOKEN")

  except exceptions.api.InvalidCredentials as error:
    print(error)

Account

from powerlingapi import PowerlingApi
from powerlingapi import exceptions
from powerlingapi import Form

def main():
  # [initialization...]

  api.account()

Supported languages

from powerlingapi import PowerlingApi
from powerlingapi import exceptions
from powerlingapi import Form

def main():
  # [initialization...]

  api.supported_langs()

Order

Create

from powerlingapi import PowerlingApi
from powerlingapi import exceptions
from powerlingapi import Form

def main():
  # [initialization...]

  new_order = Form.Order("New order")

  try:
    order = api.create_order(new_order)

  except exceptions.order.ErrorOnCreation as error_on_creation:
    print(error_on_creation)

  except Exception as error:
    print(error)

Get

from powerlingapi import PowerlingApi
from powerlingapi import exceptions

def main():
  # [initialization...]

  try:
    order = api.get_order_by_id(123)

  except exceptions.order.NotFound as error_not_found:
    print(error_not_found)

  except Exception as error:
    print(error)

Submit

from powerlingapi import PowerlingApi

def main():
  # [initialization...]

  # [get an order with id or create new one]
  order.submit()

Add callback

from powerlingapi import PowerlingApi

def main():
  # [initialization...]

  url = "https://exemple.com/callback"

  # [get an order with id or create new one]
  order.add_callback(url)

Get analysis

from powerlingapi import PowerlingApi

def main():
  # [initialization...]

  # [get an order with id or create new one]
  order.get_analysis()

Add binary file

from powerlingapi import PowerlingApi
from powerlingapi import exceptions
from powerlingapi import Form

def main():
  # [initialization...]

  try:
    form_file = Form.FileBinary('fr_FR', 'de_DE', 'file.xlf')

    # [get an order with id or create new one]
    file_id = order.add_bin_file(form_file)

  except exceptions.form.InvalidFormFileBinary as invalid_form:
    print(invalid_form)

  except exceptions.file.ErrorOnUpload as error_on_upload:
    print(error_on_upload)

  except Exception as error:
    print(error)

Add url file

from powerlingapi import PowerlingApi
from powerlingapi import exceptions
from powerlingapi import Form

def main():
  # [initialization...]

  try:
    form_file = Form.FileUrl('fr_FR', 'de_DE', 'https://exemple.com/file.xlf')

    # [get an order with id or create new one]
    file_id = order.add_url_file(form_file)

  except exceptions.form.InvalidFormFileUrl as invalid_form:
    print(invalid_form)

  except exceptions.file.ErrorOnUpload as error_on_upload:
    print(error_on_upload)

  except Exception as error:
    print(error)

Json File


File

Get

from powerlingapi import PowerlingApi

def main():
  # [initialization...]

  # [get an order with id or create new one]
  files = order.get_files() # Get all files attached to the order

  the_file = order.get_file_by_id(123) # Get specific file from the order

  completed_files = order.get_files_by_status("completed") # Get all files with specific status

Status

from powerlingapi import PowerlingApi

def main():
  # [initialization...]

  # [get a file]
  file.status()

Download

from powerlingapi import PowerlingApi

def main():
  # [initialization...]

  # [get a file]
  file.download()

Add callback

from powerlingapi import PowerlingApi

def main():
  # [initialization...]

  url = "https://exemple.com/callback"

  # [get a file]
  file.add_callback(url)

Cancel callback

from powerlingapi import PowerlingApi

def main():
  # [initialization...]

  # [get a file]
  file.cancel_callback()

Get analisys

from powerlingapi import PowerlingApi

def main():
  # [initialization...]

  # [get a file]
  file.get_analisys()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

powerling_api_sdk-0.1.7-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

Details for the file powerling_api_sdk-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for powerling_api_sdk-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4b58c4717653f3d939a339dfa7614716ce7fe7f4ede5943b91bf1e9b4e00e439
MD5 27ce5cd8626568564d85af3ee4dec496
BLAKE2b-256 04645824dbf07468b84ef770356852de187f7d1cb6dbc50ad1ef1a1e4ae6c78e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page