import gitlab
import json
import io
gl = gitlab.Gitlab(
private_token='xxxxxxxxx')
gl.auth()
projects = gl.projects.list(owned=True, search='Python')
raw_content = projects[0].files.raw(file_path='8_JSON_Module/json_HW.json', ref='main')
f = io.BytesIO()
f.write(raw_content)
f.seek(0)
data = json.load(f) # read from the file
... do some manipulations with variable data
f = project.files.get(file_path='README.rst', ref='main')
decoded_content = f.decode()
new_content = modify_content(decoded_content) # you implement this
# update the contents and commit the changes
f.content = new_content
f.save(branch='main', commit_message='Update file')