Skip to content

Commit

Permalink
Fix the PyPI project owner scraping heuristic. (pantsbuild#8144)
Browse files Browse the repository at this point in the history
Apparently PyPI changed their HTML structure recently.
  • Loading branch information
benjyw authored Aug 7, 2019
1 parent 2a58b4d commit 79fd87b
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/python/pants/releases/packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,13 @@ def latest_version(self):
j = json.load(f)
return j["info"]["version"]

def owners(self,
html_node_type='a',
html_node_class='sidebar-section__user-gravatar',
html_node_attr='aria-label'):
def owners(self):
url = "https://pypi.org/pypi/{}/{}".format(self.name, self.latest_version())
url_content = urlopen(url).read()
parser = BeautifulSoup(url_content, 'html.parser')
owners = [
item.attrs[html_node_attr]
for item
in parser.find_all(html_node_type, class_=html_node_class)
]
return {owner.lower() for owner in owners}
owners = {span.find('a', recursive=False).get_text().strip().lower()
for span in parser.find_all('span', class_='sidebar-section__maintainer')}
return owners


def core_packages():
Expand Down

0 comments on commit 79fd87b

Please sign in to comment.