summaryrefslogtreecommitdiff
path: root/docs/gl_objects/projects.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2016-11-01 14:38:58 +0100
committerGauvain Pocentek <gauvain@pocentek.net>2016-11-01 14:38:58 +0100
commitca014f8c3e4877a4cc1ae04e1302fb57d39f47c4 (patch)
treecef16168d42be6cb7d7bfcbc703d01991b8c021b /docs/gl_objects/projects.py
parent4689e73b051fa985168cb648f49ee2dd6b6df523 (diff)
downloadgitlab-ca014f8c3e4877a4cc1ae04e1302fb57d39f47c4.tar.gz
docs: add a note for python 3.5 for file content update
The data passed to the JSON serializer must be a string with python 3. Document this in the exemples. Fix #175
Diffstat (limited to 'docs/gl_objects/projects.py')
-rw-r--r--docs/gl_objects/projects.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/gl_objects/projects.py b/docs/gl_objects/projects.py
index c2bc5aa..ed99cec 100644
--- a/docs/gl_objects/projects.py
+++ b/docs/gl_objects/projects.py
@@ -229,7 +229,9 @@ f.content = 'new content'
f.save(branch_name='master', commit_message='Update testfile')
# or for binary data
-f.content = base64.b64encode(open('image.png').read())
+# Note: decode() is required with python 3 for data serialization. You can omit
+# it with python 2
+f.content = base64.b64encode(open('image.png').read()).decode()
f.save(branch_name='master', commit_message='Update testfile', encoding='base64')
# end files update