(module_name: str, class_name: str, *args, **kwargs)
| 177 | return JSONResponse(content={"message": "Database cleared."}) |
| 178 | |
| 179 | def import_strategy(module_name: str, class_name: str, *args, **kwargs): |
| 180 | try: |
| 181 | module = importlib.import_module(module_name) |
| 182 | strategy_class = getattr(module, class_name) |
| 183 | return strategy_class(*args, **kwargs) |
| 184 | except ImportError: |
| 185 | print("ImportError: Module not found.") |
| 186 | raise HTTPException(status_code=400, detail=f"Module {module_name} not found.") |
| 187 | except AttributeError: |
| 188 | print("AttributeError: Class not found.") |
| 189 | raise HTTPException(status_code=400, detail=f"Class {class_name} not found in {module_name}.") |
| 190 | |
| 191 | @app.post("/crawl") |
| 192 | @limiter.limit(get_rate_limit()) |
no outgoing calls
no test coverage detected
searching dependent graphs…