Skip to content

Commit

Permalink
removed a pitfall where the code was using a default mutable argument (
Browse files Browse the repository at this point in the history
  • Loading branch information
NaelsonDouglas committed Oct 18, 2021
1 parent cd43282 commit 20c4509
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sflib.py
Original file line number Diff line number Diff line change
Expand Up @@ -2364,7 +2364,7 @@ def checkDnsWildcard(self, target: str) -> bool:

return True

def googleIterate(self, searchString: str, opts: dict = {}) -> dict:
def googleIterate(self, searchString: str, opts: dict = None) -> dict:
"""Request search results from the Google API.
Will return a dict:
Expand All @@ -2384,7 +2384,8 @@ def googleIterate(self, searchString: str, opts: dict = {}) -> dict:
Returns:
dict: Search results as {"webSearchUrl": "URL", "urls": [results]}
"""

if opts is None:
opts = {}
search_string = searchString.replace(" ", "%20")
params = urllib.parse.urlencode({
"cx": opts["cse_id"],
Expand Down

0 comments on commit 20c4509

Please sign in to comment.