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)

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)

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)

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

powerling-api-sdk-0.1.3.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

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

powerling_api_sdk-0.1.3-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file powerling-api-sdk-0.1.3.tar.gz.

File metadata

  • Download URL: powerling-api-sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for powerling-api-sdk-0.1.3.tar.gz
Algorithm Hash digest
SHA256 8fcbefa950df8bd2d9efb73aa9292884f565bdae49bf408d796c6eb3c32f549d
MD5 b441fd424915ed162aa1374592fcee74
BLAKE2b-256 968cd5293d9d9e774727e53bf6895b537ad7e4f57849efaed19dfe12fddf40dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for powerling_api_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 54d4e390714d1dfdd5e77519c909822383deac1526c6ee1f060a36762ea9f30d
MD5 1ab5079a68ba6c43de54886f43f61d03
BLAKE2b-256 48268eb877d065a934a11e9efffe73e5fb77eddac04c3be5ac9f0244b956e110

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