Skip to content

SpiderFoot automates OSINT for threat intelligence and mapping your attack surface.

Merge branch 'master' into flake8-modules

Steve Micallefc55b090316ff
diff --cc modules/sfp_github.py
index e581b004,c4219625..1cd6ce5b
--- a/modules/sfp_github.py
+++ b/modules/sfp_github.py
@@@ -170,26 -163,24 +170,27 @@@ class sfp_github(SpiderFootPlugin)
# Get all the repositories based on direct matches with the
# name identified
- url = "https://api.github.com/search/repositories?q=" + name
- res = self.sf.fetchUrl(url, timeout=self.opts['_fetchtimeout'],
- useragent=self.opts['_useragent'])
-
- if res['content'] == None:
- self.sf.error("Unable to fetch " + url, False)
+ url = f"https://api.github.com/search/repositories?q={username}"
+ res = self.sf.fetchUrl(
+ url,
+ timeout=self.opts['_fetchtimeout'],
+ useragent=self.opts['_useragent']
+ )
+
+ if res['content'] is None:
+ self.sf.error(f"Unable to fetch {url}", False)
failed = True
- try:
- ret = json.loads(res['content'])
- except BaseException as e:
- self.sf.debug(f"Error processing JSON response from GitHub: {e}", False)
- ret = None
-
- if ret is None:
- self.sf.error(f"Unable to process empty response from Github for: {username}", False)
- failed = True
+ if not failed:
+ try:
+ ret = json.loads(res['content'])
+ except BaseException as e:
+ self.sf.debug(f"Error processing JSON response from GitHub: {e}")
+ ret = None
+
+ if ret is None:
- self.sf.error(f"Unable to process empty response from Github for: {name}", False)
++ self.sf.error(f"Unable to process empty response from Github for: {username}", False)
+ failed = True
if not failed:
if ret.get('total_count', "0") == "0" or len(ret['items']) == 0: