@@ -822,6 +822,8 @@ def import_project(
822
822
Args:
823
823
file: Data or file object containing the project
824
824
path: Name and path for the new project
825
+ name: The name of the project to import. If not provided,
826
+ defaults to the path of the project.
825
827
namespace: The ID or path of the namespace that the project
826
828
will be imported to
827
829
overwrite: If True overwrite an existing project with the
@@ -849,6 +851,49 @@ def import_project(
849
851
"/projects/import" , post_data = data , files = files , ** kwargs
850
852
)
851
853
854
+ def import_project_from_remote (
855
+ self ,
856
+ url : str ,
857
+ path : str ,
858
+ name : Optional [str ] = None ,
859
+ namespace : Optional [str ] = None ,
860
+ overwrite : bool = False ,
861
+ override_params : Optional [Dict [str , Any ]] = None ,
862
+ ** kwargs : Any ,
863
+ ) -> Union [Dict [str , Any ], requests .Response ]:
864
+ """Import a project from an archive file stored on a remote URL.
865
+
866
+ Args:
867
+ url: URL for the file containing the project data to import
868
+ path: Name and path for the new project
869
+ name: The name of the project to import. If not provided,
870
+ defaults to the path of the project.
871
+ namespace: The ID or path of the namespace that the project
872
+ will be imported to
873
+ overwrite: If True overwrite an existing project with the
874
+ same path
875
+ override_params: Set the specific settings for the project
876
+ **kwargs: Extra options to send to the server (e.g. sudo)
877
+
878
+ Raises:
879
+ GitlabAuthenticationError: If authentication is not correct
880
+ GitlabListError: If the server failed to perform the request
881
+
882
+ Returns:
883
+ A representation of the import status.
884
+ """
885
+ data = {"path" : path , "overwrite" : str (overwrite ), "url" : url }
886
+ if override_params :
887
+ for k , v in override_params .items ():
888
+ data [f"override_params[{ k } ]" ] = v
889
+ if name is not None :
890
+ data ["name" ] = name
891
+ if namespace :
892
+ data ["namespace" ] = namespace
893
+ return self .gitlab .http_post (
894
+ "/projects/remote-import" , post_data = data , ** kwargs
895
+ )
896
+
852
897
def import_bitbucket_server (
853
898
self ,
854
899
bitbucket_server_url : str ,
0 commit comments