Python BeautifulSoup.BeautifulStoneSoup() Examples
The following are 4
code examples of BeautifulSoup.BeautifulStoneSoup().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
BeautifulSoup
, or try the search function
.
Example #1
Source File: xbrl.py From python-xbrl with Apache License 2.0 | 5 votes |
def soup_maker(fh): """ Takes a file handler returns BeautifulSoup""" try: from bs4 import BeautifulSoup soup = BeautifulSoup(fh, "lxml") for tag in soup.find_all(): tag.name = tag.name.lower() except ImportError: from BeautifulSoup import BeautifulStoneSoup soup = BeautifulStoneSoup(fh) return soup
Example #2
Source File: xbrl.py From python-xbrl with Apache License 2.0 | 5 votes |
def soup_maker(fh): """ Takes a file handler returns BeautifulSoup""" try: from bs4 import BeautifulSoup soup = BeautifulSoup(fh, "lxml") for tag in soup.find_all(): tag.name = tag.name.lower() except ImportError: from BeautifulSoup import BeautifulStoneSoup soup = BeautifulStoneSoup(fh) return soup
Example #3
Source File: backend_config.py From EasyStorj with MIT License | 5 votes |
def save_custom_temp_path(self, custom_path): with open(CONFIG_FILE, 'r') as conf_file: XML_conf_data = conf_file.read().replace('\n', '') soup = Soup(XML_conf_data) custom_tmp_path_tag = soup.configuration.client.custom_temp_path custom_tmp_path_tag['path'] = 'Updated' return True
Example #4
Source File: common.py From anytask with MIT License | 4 votes |
def get_contest_mark(contest_id, problem_id, ya_login): results_req = FakeResponse() contest_mark = None user_id = None ya_login = convert_to_contest_login(ya_login) try: results_req = requests.get( settings.CONTEST_URL + 'action/api/download-log?contestId=' + str(contest_id) + '&snarkKey=spike') try: contest_dict = xmltodict.parse(results_req.content) users = contest_dict['contestLog']['users']['user'] for user in users: if convert_to_contest_login(user['@loginName']) == ya_login: user_id = user['@id'] break submits = contest_dict['contestLog']['events']['submit'] submits.reverse() for submit in submits: if submit['@userId'] == user_id and submit['@problemTitle'] == problem_id \ and submit['@verdict'] == 'OK': contest_mark = submit['@score'] break except: # noqa soup = BeautifulStoneSoup(results_req.content) users = soup.contestlog.users.user while users: if users != '\n': if convert_to_contest_login(users['loginname']) == ya_login: user_id = users['id'] break users = users.next submits = soup.contestlog.events.submit while submits: if submits != '\n' and submits.name != 'testinglog' and 'userid' in submits: if submits['userid'] == user_id and submits['problemtitle'] == problem_id \ and submits['verdict'] == 'OK': contest_mark = submits['score'] break submits = submits.next except Exception as e: logger.exception("Exception while request to Contest: '%s', Exception: '%s'", results_req.url, e) return contest_mark