Skip to content

Commit c7b3f96

Browse files
author
Gauvain Pocentek
committed
[docs] Commits: add an example of binary file creation
Binary files need to be encoded in base64. Fixes #427
1 parent 4a2ae8a commit c7b3f96

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

docs/gl_objects/commits.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@
1717
'actions': [
1818
{
1919
'action': 'create',
20-
'file_path': 'blah',
21-
'content': 'blah'
20+
'file_path': 'README.rst',
21+
'content': open('path/to/file.rst').read(),
22+
},
23+
{
24+
# Binary files need to be base64 encoded
25+
'action': 'create',
26+
'file_path': 'logo.png',
27+
'content': base64.b64encode(open('logo.png').read()),
28+
'encoding': 'base64',
2229
}
2330
]
2431
}

0 commit comments

Comments
 (0)