File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
src/backend/expungeservice/endpoints Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change 11from os import path
22from pathlib import Path
3+ import time
34
45from bs4 import BeautifulSoup
56from flask .views import MethodView
1011class CaseDetailPage (MethodView ):
1112 def get (self , id ):
1213 url = f"https://publicaccess.courts.oregon.gov/PublicAccessLogin/CaseDetail.aspx?CaseID={ id } "
13- html = Crawler .fetch_link (url )
14- if html :
15- return CaseDetailPage ._strip_links (html )
16- else :
17- return f"Case detail page with ID of { id } does not exist."
14+
15+ max_retries = 3
16+ backoff_seconds = 2
17+ # Retry loop with backoff
18+ for attempt in range (max_retries ):
19+ html = Crawler .fetch_link (url )
20+ if html :
21+ return CaseDetailPage ._strip_links (html )
22+
23+ if attempt < max_retries - 1 :
24+ time .sleep (backoff_seconds )
25+
26+ return f"Case detail page with ID of { id } does not exist."
1827
1928 @staticmethod
2029 def _strip_links (html ):
You can’t perform that action at this time.
0 commit comments