示例#1
0
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
示例#2
0
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
示例#3
0
def test_get_useragent__with_100_random_useragents(count):
    pattern = re.compile('.+/.+\(.+')
    agent = canteen.get_useragent()
    assert pattern.match(agent) is not None