From c7b3f969fc3fcf9d057a23638d121f51513bb13c Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Mon, 5 Mar 2018 16:25:57 +0100 Subject: [docs] Commits: add an example of binary file creation Binary files need to be encoded in base64. Fixes #427 --- docs/gl_objects/commits.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/gl_objects/commits.py b/docs/gl_objects/commits.py index f7e73e5..88d0095 100644 --- a/docs/gl_objects/commits.py +++ b/docs/gl_objects/commits.py @@ -17,8 +17,15 @@ data = { 'actions': [ { 'action': 'create', - 'file_path': 'blah', - 'content': 'blah' + 'file_path': 'README.rst', + 'content': open('path/to/file.rst').read(), + }, + { + # Binary files need to be base64 encoded + 'action': 'create', + 'file_path': 'logo.png', + 'content': base64.b64encode(open('logo.png').read()), + 'encoding': 'base64', } ] } -- cgit v1.2.1