Python Forum

Full Version: PyPi 100000
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
It's close Dance
import requests
from bs4 import BeautifulSoup

url = "https://pypi.python.org/pypi"
url_get = requests.get(url)
soup = BeautifulSoup(url_get.content, 'html.parser')
print(soup.find('strong').text)
Output:
99992
Who will be 100,000?
There should be a prize!
like:
All the bits you can use for the rest of your life
import requests
from bs4 import BeautifulSoup
import schedule
import datetime, time

def PyPi_check():
   url = "https://pypi.python.org/pypi"
   url_get = requests.get(url)
   soup = BeautifulSoup(url_get.content, 'html.parser')
   count = soup.find('strong').text
   print(count)
   if int(count) == 100000:
       with open('pypi.txt', 'w') as f:
           f.write(f'PyPi reached 100000 packages at: {datetime.datetime.now()}')
           return schedule.CancelJob

schedule.every(.1).minutes.do(PyPi_check)
while True:
   schedule.run_pending()
   time.sleep(1)
Output:
PyPi reached 100000 packages at: 2017-03-05 00:58:33.121786