Spaces:
Sleeping
Sleeping
Andy Lee
commited on
Commit
·
9f00612
1
Parent(s):
04ae29a
feat: retying for loading page
Browse files- mapcrunch_controller.py +11 -2
mapcrunch_controller.py
CHANGED
|
@@ -49,8 +49,16 @@ class MapCrunchController:
|
|
| 49 |
},
|
| 50 |
)
|
| 51 |
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
def setup_clean_environment(self):
|
| 56 |
"""
|
|
@@ -195,6 +203,7 @@ class MapCrunchController:
|
|
| 195 |
)
|
| 196 |
except Exception:
|
| 197 |
return "Stealth Mode"
|
|
|
|
| 198 |
def pan_view(self, direction: str, degrees: int = 45):
|
| 199 |
"""Pans the view using a direct JS call."""
|
| 200 |
pov = self.driver.execute_script("return window.panorama.getPov();")
|
|
|
|
| 49 |
},
|
| 50 |
)
|
| 51 |
|
| 52 |
+
for retry in range(3):
|
| 53 |
+
try:
|
| 54 |
+
self.driver.get(MAPCRUNCH_URL)
|
| 55 |
+
time.sleep(3)
|
| 56 |
+
break
|
| 57 |
+
except Exception as e:
|
| 58 |
+
if retry == 2:
|
| 59 |
+
raise e
|
| 60 |
+
print(f"Failed to load MapCrunch, retry {retry + 1}/3")
|
| 61 |
+
time.sleep(2)
|
| 62 |
|
| 63 |
def setup_clean_environment(self):
|
| 64 |
"""
|
|
|
|
| 203 |
)
|
| 204 |
except Exception:
|
| 205 |
return "Stealth Mode"
|
| 206 |
+
|
| 207 |
def pan_view(self, direction: str, degrees: int = 45):
|
| 208 |
"""Pans the view using a direct JS call."""
|
| 209 |
pov = self.driver.execute_script("return window.panorama.getPov();")
|