Spaces:
Running
Running
Commit
·
bd52915
1
Parent(s):
03fbd26
Improve URL parsing in parse_id_from_url function to handle invalid URLs gracefully
Browse files- populate_user.py +3 -5
populate_user.py
CHANGED
@@ -10,11 +10,9 @@ from urllib.parse import urlparse
|
|
10 |
|
11 |
|
12 |
def parse_id_from_url(url):
|
13 |
-
|
14 |
-
return
|
15 |
-
|
16 |
-
print(f"Error parsing URL {url}: {e}")
|
17 |
-
breakpoint()
|
18 |
|
19 |
|
20 |
def add_author(user_info, updated_date):
|
|
|
10 |
|
11 |
|
12 |
def parse_id_from_url(url):
|
13 |
+
if (not url) or (not url.startswith("http")):
|
14 |
+
return "N/A"
|
15 |
+
return urlparse(url).path.strip('/').split('/')[-1]
|
|
|
|
|
16 |
|
17 |
|
18 |
def add_author(user_info, updated_date):
|