From 52cac358b402bd288e7a624cd05a49ffa65b760a Mon Sep 17 00:00:00 2001 From: Mohammad Osama Khan Date: Wed, 28 Dec 2022 21:23:42 +0530 Subject: [PATCH] Uploaded messages.pot using config file --- .tx/config | 9 +++++++++ transifex_flask/flask_app/app.py | 16 ++++++++++++++-- transifex_upload.sh | 3 +++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .tx/config create mode 100755 transifex_upload.sh diff --git a/.tx/config b/.tx/config new file mode 100644 index 0000000..6bef1ca --- /dev/null +++ b/.tx/config @@ -0,0 +1,9 @@ +[main] +host = https://www.transifex.com +api_token = 1/6e168158bf4c122556d028e38a0cb6016fcb0688 +[pybitmessage-test.messages-pot] +file_filter = po +minimum_perc = 0 +source_file = messages.pot +source_lang = en +type = PO diff --git a/transifex_flask/flask_app/app.py b/transifex_flask/flask_app/app.py index 65333ac..b7ca063 100644 --- a/transifex_flask/flask_app/app.py +++ b/transifex_flask/flask_app/app.py @@ -88,9 +88,21 @@ def async_job(id): language = transifex_api.Language.get(code="fr") resource = project.fetch('resources').get(slug="messagespot") content = "The new source file content" - transifex_api.ResourceStringsAsyncUpload.upload(resource, content) + with open(resource,'rb') as f: + upload = transifex_api.ResourceStringsAsyncUpload.create_with_form( + data={'resource': resource.id}, + files={'content': f}, + ) + return "done" + # transifex_api.ResourceStringsAsyncUpload.upload(resource, content) while not response: - time.sleep(1) + sleep_time = time.sleep(1) + sleep_time+=1 + if sleep_time == 600: + return False + + + diff --git a/transifex_upload.sh b/transifex_upload.sh new file mode 100755 index 0000000..fc01756 --- /dev/null +++ b/transifex_upload.sh @@ -0,0 +1,3 @@ +pip install transifex-client +# chmod 777 '/home/cis/PyBitmessage/transifex/transifex-webhook/.tx/config' +tx init \ No newline at end of file