Commit
·
d152bd8
1
Parent(s):
083b21d
split error again
Browse files
regulatory_comments_api.py
CHANGED
|
@@ -180,16 +180,16 @@ class RegulationsDataFetcher:
|
|
| 180 |
comment_text = comment_text.replace("<br/>", "").replace("<span style='padding-left: 30px'></span>", "")
|
| 181 |
comment_text = re.sub(r'&[^;]+;', '', comment_text)
|
| 182 |
|
| 183 |
-
if comment_text and "attached" not in comment_text.lower() and "attachment" not in comment_text.lower() and comment_text.lower() != "n/a":
|
| 184 |
nested_comment = {
|
| 185 |
"text": comment_text,
|
| 186 |
"comment_id": comment['id'],
|
| 187 |
"comment_url": comment['links']['self'],
|
| 188 |
"comment_date": comment['attributes']['postedDate'].split('T')[0],
|
| 189 |
"comment_time": comment['attributes']['postedDate'].split('T')[1].strip('Z'),
|
| 190 |
-
"commenter_fname": (comment_data.get('firstName'
|
| 191 |
-
"commenter_lname": (comment_data.get('lastName'
|
| 192 |
-
"comment_length": len(comment_text)
|
| 193 |
}
|
| 194 |
nested_data["comments"].append(nested_comment)
|
| 195 |
|
|
|
|
| 180 |
comment_text = comment_text.replace("<br/>", "").replace("<span style='padding-left: 30px'></span>", "")
|
| 181 |
comment_text = re.sub(r'&[^;]+;', '', comment_text)
|
| 182 |
|
| 183 |
+
if (comment_text and "attached" not in comment_text.lower() and "attachment" not in comment_text.lower() and comment_text.lower() != "n/a"):
|
| 184 |
nested_comment = {
|
| 185 |
"text": comment_text,
|
| 186 |
"comment_id": comment['id'],
|
| 187 |
"comment_url": comment['links']['self'],
|
| 188 |
"comment_date": comment['attributes']['postedDate'].split('T')[0],
|
| 189 |
"comment_time": comment['attributes']['postedDate'].split('T')[1].strip('Z'),
|
| 190 |
+
"commenter_fname": ((comment_data.get('firstName') or 'Anonymous').split(',')[0]).capitalize(),
|
| 191 |
+
"commenter_lname": ((comment_data.get('lastName') or 'Anonymous').split(',')[0]).capitalize(),
|
| 192 |
+
"comment_length": len(comment_text) if comment_text is not None else 0
|
| 193 |
}
|
| 194 |
nested_data["comments"].append(nested_comment)
|
| 195 |
|