Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc7b3f96

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 parent4a2ae8a commitc7b3f96

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

‎docs/gl_objects/commits.py

Lines changed: 9 additions & 2 deletions
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)

[8]ページ先頭

©2009-2025 Movatter.jp