Skip to content

Commit 9e8f351

Browse files
committed
wip
1 parent e1365d0 commit 9e8f351

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

paperscraper/citations/utils.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,17 +129,17 @@ async def author_name_to_ssaid(author_name: str) -> Tuple[str, str]:
129129
params={"query": author_name, "fields": "name", "limit": 1},
130130
headers=HEADERS,
131131
)
132-
if response.status_code == 200:
133-
data = response.json()
134-
authors = data.get("data", [])
135-
if authors:
136-
# Return the Semantic Scholar author ID from the first result.
137-
return authors[0].get("authorId"), authors[0].get("name")
132+
response.raise_for_status()
133+
data = response.json()
134+
authors = data.get("data", [])
135+
if authors:
136+
# Return the Semantic Scholar author ID from the first result.
137+
return authors[0]["authorId"], authors[0]["name"]
138138

139139
logger.error(
140140
f"Error in retrieving name from SS Author ID: {response.status_code} - {response.text}"
141141
)
142-
return ('-1', 'N.A.')
142+
return ('-1', 'N.A.')
143143

144144

145145
def determine_paper_input_type(input: str) -> Literal["ssid", "doi", "title"]:

0 commit comments

Comments
 (0)