From fcf9a26a1e7b0aab825683c4112f306eab3290f9 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Sun, 5 May 2019 14:22:35 +0200 Subject: [PATCH] bluetooth_data_types: follow changes on Bluetooth SIG site --- tool/bluetooth_data_types.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tool/bluetooth_data_types.py b/tool/bluetooth_data_types.py index 2770a012e..2fe6f9fa5 100755 --- a/tool/bluetooth_data_types.py +++ b/tool/bluetooth_data_types.py @@ -11,6 +11,8 @@ import requests import sys import os +headers = {'user-agent': 'curl/7.63.0'} + program_info = ''' BTstack Data Types Scraper for BTstack Copyright 2016, BlueKitchen GmbH @@ -41,15 +43,15 @@ def clean(tag): def scrape_page(fout, url): print("Parsing %s" % url) - page = requests.get(url) + page = requests.get(url, headers=headers) tree = html.fromstring(page.content) print('') print('%-48s | %s' % ("Data Type Name", "Data Type Value")) print('-' * 70) - # get all elements in - rows = tree.xpath('//div[@class="copy-block ta-left"]/table/tbody/tr') + # get all elements in
+ rows = tree.xpath('//table/tbody/tr') for row in rows: children = row.getchildren() data_type_value = children[0].text_content()