MCPcopy
hub / github.com/unclecode/crawl4ai / import_strategy

Function import_strategy

main.py:179–189  ·  view source on GitHub ↗
(module_name: str, class_name: str, *args, **kwargs)

Source from the content-addressed store, hash-verified

177 return JSONResponse(content={"message": "Database cleared."})
178
179def 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())

Callers 1

crawl_urlsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…