Last active
June 28, 2018 03:49
-
-
Save thcipriani/c303e39d6e8044307fa292cac6de6bd6 to your computer and use it in GitHub Desktop.
White Labs started putting a disclaimer about strains that have a potential indicator of Saccharomyces cerevisiae var. diastaticus. This is a script to find all the strains that have it.
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 python3 | |
import os | |
import requests | |
from bs4 import BeautifulSoup | |
base_url = 'https://www.whitelabs.com' | |
page = ('yeast-bank?keywords=' | |
'&flocculation=0&type=yeasts&temp_from=1&temp_to=100' | |
'&atten_from=1&atten_to=100&tolerance=0&drink_type=0' | |
'&yeast_type=0&op=SHOW+ALL+STRAINS&' | |
'form_build_id=form-_H4aVdVBHaR6QrSjRVaoxpPK9_bUyXFKKrjDYSjTngs&' | |
'form_id=whitelabs_yeast_yeast_bank_form') | |
r = requests.get(os.path.join(base_url, page)) | |
r.raise_for_status() | |
soup = BeautifulSoup(r.text, 'html.parser') | |
all_urls = [] | |
for info in soup.find_all(string='More Information', href=True): | |
strain = info.find_parent(attrs={'class': 'yeast-details'}) | |
strain = strain.find(attrs={'class': 'yeast-desc'}) | |
strain = strain.find('h2').text.strip() | |
url = info['href'] | |
if not url.startswith(base_url): | |
url = os.path.join(base_url, url) | |
all_urls.append((strain, url)) | |
for strain, url in all_urls: | |
print('... Getting %s' % url) | |
r = requests.get(url) | |
# I get a 403 on a few... | |
if r.status_code != 200: | |
print('FAILED!') | |
continue | |
strain_soup = BeautifulSoup(r.text, 'html.parser') | |
content = strain_soup.find(attrs={'class': 'region-content'}) | |
if 'diastaticus' in content.text: | |
print('%s has it!' % strain.encode('utf8')) | |
else: | |
print('%s is clean...' % strain.encode('utf8')) |
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
'WLP037 Yorkshire Square Ale Yeast' has it! | |
'WLP038 Manchester Ale Yeast' has it! | |
'WLP045 Scotch Whisky Yeast' has it! | |
'WLP067 Coastal Haze Ale Yeast Blend' has it! | |
'WLP073 Artisanal Country Ale Yeast' has it! | |
'WLP099 Super High Gravity Ale Yeast' has it! | |
'WLP351 Bavarian Weizen Yeast' has it! | |
'WLP545 Belgian Strong Ale Yeast' has it! | |
'WLP565 Belgian Saison I Yeast' has it! | |
'WLP566 Belgian Saison II Ale Yeast' has it! | |
'WLP568 Belgian Style Saison Ale Yeast Blend' has it! | |
'WLP570 Belgian Golden Ale Yeast' has it! | |
'WLP590 French Saison Ale Yeast' has it! | |
'WLP644 Saccharomyces "bruxellensis" Trois' has it! | |
'WLP670 American Farmhouse Blend' has it! | |
'WLP707 California Pinot Noir Yeast' has it! | |
'WLP740 Merlot Red Wine Yeast' has it! | |
'WLP885 Zurich Lager Yeast' has it! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment