def download_menu(canteen_id, date): url = 'https://www.stw.berlin/xhr/speiseplan-wochentag.html' params = {'resources_id': canteen_id, 'date': date} headers = {'user-agent': get_useragent()} request = requests.post(url, data=params, headers=headers) request.raise_for_status() return request.text
def download_business_hours(canteen_id): url = 'https://www.stw.berlin/xhr/speiseplan-und-standortdaten.html' params = {'resources_id': canteen_id, 'date': datetime.date.today().strftime(DATE_FORMAT_API)} headers = {'user-agent': get_useragent()} request = requests.post(url, data=params, headers=headers) request.raise_for_status() return request.text
def test_get_useragent__with_100_random_useragents(count): pattern = re.compile('.+/.+\(.+') agent = canteen.get_useragent() assert pattern.match(agent) is not None