class SmartlingApiExample: HOST = 'sandbox-api.smartling.com' MY_API_KEY = "YOUR_API_KEY" MY_PROJECT_ID = "YOUR_PROJECT_ID" def __init__(self, useSandbox, uploadData, locale, new_name): if useSandbox : self.fapi = SmartlingFileApiFactory().getSmartlingTranslationApi(False, self.MY_API_KEY, self.MY_PROJECT_ID) else: self.fapi = SmartlingFileApiFactory().getSmartlingTranslationApiProd(self.MY_API_KEY, self.MY_PROJECT_ID) self.uploadData = uploadData self.locale = locale self.new_name = new_name def printMarker(self, caption): print "--" + caption + "-"*40 def test(self): self.printMarker("file upload") print self.fapi.upload(uploadData) self.printMarker("files list") print self.fapi.list() self.printMarker("file status") print self.fapi.status(self.uploadData.name, self.locale) self.printMarker("file from server goes here") print self.fapi.get( self.uploadData.name, self.locale) self.printMarker("renaming file") print self.fapi.rename(self.uploadData.name, self.new_name) self.printMarker("delete from server goes here") print self.fapi.delete(self.new_name) self.printMarker("doing list again to see if it's deleted") print self.fapi.list()