Skip to content

Commit

Permalink
laramies#1383 fix githubcode.py
Browse files Browse the repository at this point in the history
  • Loading branch information
yoonthegoon committed Jul 24, 2023
1 parent b7aba8e commit 8468e47
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions theHarvester/discovery/githubcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class RetryResult(NamedTuple):
class SuccessResult(NamedTuple):
fragments: List[str]
next_page: Union[int, None]
last_page: int
last_page: Union[int, None]


class ErrorResult(NamedTuple):
Expand All @@ -32,7 +32,7 @@ def __init__(self, word, limit) -> None:
self.server = "api.github.com"
self.limit = limit
self.counter: int = 0
self.page: int = 1
self.page: Union[int, None] = 1
self.key = Core.github_key()
# If you don't have a personal access token, GitHub narrows your search capabilities significantly
# rate limits you more severely
Expand Down Expand Up @@ -71,7 +71,6 @@ async def handle_response(
if status == 200:
results = await self.fragments_from_response(json_data)
next_page = await self.page_from_response("next", links)
# TODO: figure out what int is last page
last_page = await self.page_from_response("last", links)
return SuccessResult(results, next_page, last_page)
elif status == 429 or status == 403:
Expand Down Expand Up @@ -105,7 +104,7 @@ async def do_search(self, page: int) -> Tuple[str, dict, int, Any]:
return await resp.text(), await resp.json(), resp.status, resp.links

@staticmethod
async def next_page_or_end(result: SuccessResult) -> int:
async def next_page_or_end(result: SuccessResult) -> Union[int, None]:
if result.next_page is not None:
return result.next_page
else:
Expand Down

0 comments on commit 8468e47

Please sign in to comment.