Skip to content

Commit 8f8611a

Browse files
nejchJohnVillalovos
authored andcommitted
docs(projects): provide more detailed import examples
1 parent 522ecff commit 8f8611a

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/gl_objects/projects.rst

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,15 +289,30 @@ generated by GitLab you need to:
289289
with open('/tmp/export.tgz', 'wb') as f:
290290
export.download(streamed=True, action=f.write)
291291

292-
Import the project::
292+
Import the project into the current user's namespace::
293+
294+
with open('/tmp/export.tgz', 'rb') as f:
295+
output = gl.projects.import_project(
296+
f, path='my_new_project', name='My New Project'
297+
)
293298

294-
output = gl.projects.import_project(open('/tmp/export.tgz', 'rb'), 'my_new_project')
295299
# Get a ProjectImport object to track the import status
296300
project_import = gl.projects.get(output['id'], lazy=True).imports.get()
297301
while project_import.import_status != 'finished':
298302
time.sleep(1)
299303
project_import.refresh()
300304

305+
Import the project into a namespace and override parameters::
306+
307+
with open('/tmp/export.tgz', 'rb') as f:
308+
output = gl.projects.import_project(
309+
f,
310+
path='my_new_project',
311+
name='My New Project',
312+
namespace='my-group',
313+
override_params={'visibility': 'private'},
314+
)
315+
301316

302317
Project custom attributes
303318
=========================

0 commit comments

Comments
 (0)