-
-
Save Ydalb/d5db22f92a8c269680a3617667afafe8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import bs4 | |
import requests | |
import sys | |
from time import sleep | |
servers = ["Dedibox mWOPR SSD 2015", "Dedibox mWOPR SSD 2015 Gen2", "Dedibox ENT SSD 2015"] | |
############################################################################# | |
#requests.packages.urllib3.disable_warnings() | |
req = requests.get('https://console.online.net/fr/order/server', | |
headers={'User-agent': 'Mozilla/5.0'}) | |
for serverItem in servers: | |
data = [] | |
soup = bs4.BeautifulSoup(req.text) | |
rows = soup.find_all('tr') | |
for row in rows: | |
cols = row.find_all('td') | |
cols = [ele.text.strip() for ele in cols] | |
data.append([ele for ele in cols if ele]) | |
for item in data: | |
if serverItem in item: | |
if item[5] != "sur commande": | |
print("{0} disponible".format(serverItem)) | |
sys.exit(0) | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment