Skip to content

Commit

Permalink
fix: data parsing error after ASTM web page content change.
Browse files Browse the repository at this point in the history
  • Loading branch information
emreture committed Jan 11, 2022
1 parent 71d4e91 commit 91f6e7e
Show file tree
Hide file tree
Showing 5 changed files with 1,828 additions and 722 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this library will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 0.1.2 - 2022-01-11
### Fixed
- Data parsing error after ASTM web page content change.

## 0.1.1 - 2021-03-15
### Fixed
- Package install dependencies.
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="stdchecker",
version="0.1.1",
version="0.1.2",
author="Metin Emre TÜRE",
author_email="[email protected]",
description="A library for checking the latest revisions of standard methods published by standard bodies.",
Expand Down
2 changes: 1 addition & 1 deletion stdchecker/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from stdchecker.ieee import fetch_ieee, check_ieee, check_ieee_as_list

__title__ = "stdchecker"
__version__ = "0.1.0"
__version__ = "0.1.2"
__author__ = "Metin Emre TÜRE"
__email__ = "[email protected]"
__license__ = "MIT"
Expand Down
7 changes: 3 additions & 4 deletions stdchecker/astm.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ def fetch_astm(query_list):
html = response.text
soup = BeautifulSoup(html, "html.parser")
try:
std_name = soup.find("h5", {'itemprop': "name"}).string
std_desc = soup.find("h3", {'itemprop': "description"}).text.strip()
std_desc = ' '.join(std_desc.split()) # Remove weird multi spaces.
std_name_split = std_name.split(" - ")
std_name = soup.find("b", {'class': "sku"}).string.replace('\xa0', ' ')
std_desc = soup.find("b", {'class': "name"}).text.strip()
std_name_split = std_name.split("-")
std_number = std_name_split[0]
std_rev = std_name_split[1]
except (AttributeError, IndexError):
Expand Down
Loading

0 comments on commit 91f6e7e

Please sign in to comment.