mirror of
				https://github.com/RGBCube/GitHubWrapper
				synced 2025-10-31 05:52:45 +00:00 
			
		
		
		
	Fixing get_repo returning None for license, and erroring
This commit is contained in:
		
							parent
							
								
									45db6d5120
								
							
						
					
					
						commit
						0fa6f2b0fa
					
				
					 2 changed files with 6 additions and 3 deletions
				
			
		|  | @ -80,7 +80,7 @@ class GHClient: | |||
|         return User(await http.get_user(self.session, username), self.session) | ||||
| 
 | ||||
|     async def get_repo(self, owner: str, repo_name: str) -> Repository: | ||||
|         """Fetch aGithub repository from it's name.""" | ||||
|         """Fetch a Github repository from it's name.""" | ||||
|         return Repository(await http.get_repo_from_name(self.session, owner, repo_name), self.session) | ||||
| 
 | ||||
|     async def get_org(self, org_name: str) -> Organization: | ||||
|  |  | |||
|  | @ -28,7 +28,7 @@ class Repository(APIOBJECT): | |||
|         'stargazers_count', | ||||
|         'watchers_count', | ||||
|         'forks', | ||||
|         'license' | ||||
|         'license', | ||||
|         ) | ||||
|     def __init__(self, response: dict, session: aiohttp.ClientSession) -> None: | ||||
|         super().__init__(response, session) | ||||
|  | @ -47,12 +47,15 @@ class Repository(APIOBJECT): | |||
|                 setattr(self, key, dt_formatter(value)) | ||||
|                 continue | ||||
| 
 | ||||
|             if 'license' in key and value is None: | ||||
|                 setattr(self, key, None) | ||||
| 
 | ||||
|             else: | ||||
|                 setattr(self, key, value) | ||||
|                 continue | ||||
| 
 | ||||
|     def __repr__(self) -> str: | ||||
|         return f'<Repository; id: {self.id}, name: {self.name}, owner: {self.owner}, updated_at: {self.updated_at}, default_branch: {self.default_branch}, license: {self.license["name"]}>' | ||||
|         return f'<Repository; id: {self.id}, name: {self.name}, owner: {self.owner}, updated_at: {self.updated_at}, default_branch: {self.default_branch}, license: {self.license}>' | ||||
| 
 | ||||
|     @classmethod | ||||
|     async def from_name(cls, session: aiohttp.ClientSession,owner: str, repo_name: str) -> 'Repository': | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 VarMonke
						VarMonke