Add organization API call
							parent
							
								
									5c253cd782
								
							
						
					
					
						commit
						ccee9d70be
					
				|  | @ -613,6 +613,26 @@ class OpengnsysGitInstaller: | |||
| 
 | ||||
|         self.__logger.info("Request status was %i", r.status_code) | ||||
| 
 | ||||
|     def add_forgejo_organization(self, pubkey, description = ""): | ||||
|         token = "" | ||||
|         with open(os.path.join(self.base_path, "etc", "ogGitApiToken.cfg"), "r", encoding='utf-8') as token_file: | ||||
|             token = token_file.read().strip() | ||||
| 
 | ||||
|         self.__logger.info("Adding SSH key to Forgejo: %s", pubkey) | ||||
| 
 | ||||
|         r = requests.post( | ||||
|             f"http://localhost:{self.forgejo_port}/api/v1/user/keys", | ||||
|             json={ | ||||
|                 "key" : pubkey, | ||||
|                 "read_only" : False, | ||||
|                 "title" : description | ||||
|             }, headers={ | ||||
|                 'Authorization' : f"token {token}" | ||||
|             }, | ||||
|             timeout = 60 | ||||
|         ) | ||||
| 
 | ||||
|         self.__logger.info("Request status was %i", r.status_code) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue