Issues (8)

pythonactions/forloop_parse_github_repos.py (1 issue)

1
from bs4 import BeautifulSoup
2
3
from st2common.runners.base_action import Action
4
5
6
class ParseGithubRepos(Action):
7
    def run(self, content):
8
        try:
9
            soup = BeautifulSoup(content, 'html.parser')
10
            repo_list = soup.find_all("h3")
11
            output = {}
12
13
            for each_item in repo_list:
14
                repo_half_url = each_item.find("a")['href']
15
                repo_name = repo_half_url.split("/")[-1]
16
                repo_url = "https://github.com" + repo_half_url
17
                output[repo_name] = repo_url
18
        except Exception as e:
19
            raise Exception("Could not parse data: {}".format(six.text_type(e)))
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'six'
Loading history...
20
21
        return (True, output)
22