Package: powerling-api-sdk
Powerling API SDKInstallationFrom sourcesgitclone<url>power-api-sdkcdpower-api-sdk
pipinstall.Fromtest pypipipinstall-ihttps://test.pypi.org/simple/powerling-api-sdk-package-powerlingUsageInitializationfrompowerlingapiimportPowerlingApifrompowerlingapiimportexceptionsdefmain():api=PowerlingApi()try:api.authorize("YOUR-ACCESS-TOKEN")exceptexceptions.api.InvalidCredentialsaserror:print(error)AccountfrompowerlingapiimportPowerlingApifrompowerlingapiimportexceptionsfrompowerlingapiimportFormdefmain():# [initialization...]api.account()Supported languagesfrompowerlingapiimportPowerlingApifrompowerlingapiimportexceptionsfrompowerlingapiimportFormdefmain():# [initialization...]api.supported_langs()OrderCreatefrompowerlingapiimportPowerlingApifrompowerlingapiimportexceptionsfrompowerlingapiimportFormdefmain():# [initialization...]new_order=Form.Order("New order")try:order=api.create_order(new_order)exceptexceptions.order.ErrorOnCreationaserror_on_creation:print(error_on_creation)exceptExceptionaserror:print(error)GetfrompowerlingapiimportPowerlingApifrompowerlingapiimportexceptionsdefmain():# [initialization...]try:order=api.get_order_by_id(123)exceptexceptions.order.NotFoundaserror_not_found:print(error_not_found)exceptExceptionaserror:print(error)SubmitfrompowerlingapiimportPowerlingApidefmain():# [initialization...]# [get an order with id or create new one]order.submit()Add callbackfrompowerlingapiimportPowerlingApidefmain():# [initialization...]url="https://exemple.com/callback"# [get an order with id or create new one]order.add_callback(url)Get analysisfrompowerlingapiimportPowerlingApidefmain():# [initialization...]# [get an order with id or create new one]order.get_analysis()Add binary filefrompowerlingapiimportPowerlingApifrompowerlingapiimportexceptionsfrompowerlingapiimportFormdefmain():# [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)exceptexceptions.form.InvalidFormFileBinaryasinvalid_form:print(invalid_form)exceptexceptions.file.ErrorOnUploadaserror_on_upload:print(error_on_upload)exceptExceptionaserror:print(error)Add url filefrompowerlingapiimportPowerlingApifrompowerlingapiimportexceptionsfrompowerlingapiimportFormdefmain():# [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)exceptexceptions.form.InvalidFormFileUrlasinvalid_form:print(invalid_form)exceptexceptions.file.ErrorOnUploadaserror_on_upload:print(error_on_upload)exceptExceptionaserror:print(error)FileGetfrompowerlingapiimportPowerlingApidefmain():# [initialization...]# [get an order with id or create new one]files=order.get_files()# Get all files attached to the orderthe_file=order.get_file_by_id(123)# Get specific file from the ordercompleted_files=order.get_files_by_status("completed")# Get all files with specific statusStatusfrompowerlingapiimportPowerlingApidefmain():# [initialization...]# [get a file]file.status()DownloadfrompowerlingapiimportPowerlingApidefmain():# [initialization...]# [get a file]file.download()Add callbackfrompowerlingapiimportPowerlingApidefmain():# [initialization...]url="https://exemple.com/callback"# [get a file]file.add_callback(url)Get analysisfrompowerlingapiimportPowerlingApidefmain():# [initialization...]# [get a file]file.get_analysis()