2023-02-11 20:54:05 -05:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
from subprocess import Popen,PIPE
|
|
|
|
from bs4 import BeautifulSoup as bs
|
|
|
|
|
|
|
|
def get_html(url):
|
|
|
|
try:
|
|
|
|
curlpipe = Popen(["/usr/bin/curl","-s","-L",url],stdout=PIPE)
|
|
|
|
except:
|
|
|
|
print("- Request error: unable to retrieve {}".format(url))
|
|
|
|
return None
|
|
|
|
curltup = curlpipe.communicate()
|
|
|
|
return curltup[0]
|
|
|
|
|
2023-02-12 19:01:16 -05:00
|
|
|
page = get_html("https://pypi.org/project/python-slugify/")
|
2023-02-11 20:54:05 -05:00
|
|
|
soup = bs(page, 'lxml')
|
|
|
|
headers = soup.body.find_all('h1')
|
|
|
|
for h in headers[:1]:
|
|
|
|
name_version = h.get_text().split()
|
|
|
|
print(name_version[-1])
|