-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add capability to fetch data from multiple repos (#9)
* Add back mention and OK status discord message * merge * Add capability to fetch data from multiple repos
- Loading branch information
1 parent
2eba381
commit 3ce2e71
Showing
4 changed files
with
53 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,23 @@ | ||
# utils/git.py | ||
import requests | ||
|
||
# Function to fetch all issues (open or closed) based on the parameters | ||
def fetch_all_issues(api_url, params): | ||
all_issues = [] | ||
params_copy = params.copy() # Copy params to avoid modifying the original | ||
params_copy['page'] = 1 # Start from the first page | ||
|
||
while True: | ||
response = requests.get(api_url, params=params) | ||
response = requests.get(api_url, params=params_copy) | ||
if response.status_code != 200: | ||
print("Failed to retrieve the issues data.") | ||
exit() | ||
print(f"Failed to retrieve the issues data from {api_url}. Status code: {response.status_code}") | ||
break # Optionally handle retries or exit | ||
|
||
issues = response.json() | ||
if not issues: | ||
break # No more issues | ||
|
||
all_issues.extend(issues) | ||
params['page'] += 1 # Move to next page | ||
params_copy['page'] += 1 # Move to next page | ||
|
||
return all_issues |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters