fix invalid urls
This commit is contained in:
@@ -73,21 +73,12 @@ def get_lines_of_code(owner, repository):
|
||||
return number_of_lines_of_code
|
||||
|
||||
|
||||
def is_valid_repository(owner, repository, request_headers):
|
||||
repository_url = f"https://api.github.com/repos/{owner}/{repository}"
|
||||
repository_response = requests.get(repository_url, headers=request_headers)
|
||||
return repository_response.status_code == 200
|
||||
|
||||
|
||||
def PICable(owner, repository, token):
|
||||
margin_percentage = round(MARGIN * 100)
|
||||
request_headers = {"Authorization": f"token {token}"}
|
||||
picable_report = f"Analysis complete for the repository {owner}/{repository}.\n\n"
|
||||
repository_url = f"https://www.github.com/{owner}/{repository}"
|
||||
|
||||
if not is_valid_repository(owner, repository, request_headers):
|
||||
return f"Invalid repository: {owner}/{repository} :x:"
|
||||
|
||||
stars = get_stars_info(owner, repository, request_headers)
|
||||
if stars == -1:
|
||||
return "Error fetching stars info. :x:"
|
||||
|
||||
Reference in New Issue
Block a user