0

rearranged logic for FIRECRAWL_API_URL

It would not use the ENV unless the param was set to None which was counter-intuitive.
This commit is contained in:
Matt Joyce 2024-05-23 08:00:56 +10:00
parent 7e5ef4dec4
commit 8d041c05b4

View File

@ -4,11 +4,11 @@ import requests
import time
class FirecrawlApp:
def __init__(self, api_key=None, api_url='https://api.firecrawl.dev'):
def __init__(self, api_key: Optional[str] = None, api_url: Optional[str] = None) -> None:
self.api_key = api_key or os.getenv('FIRECRAWL_API_KEY')
if self.api_key is None:
raise ValueError('No API key provided')
self.api_url = api_url or os.getenv('FIRECRAWL_API_URL')
self.api_url = api_url or os.getenv('FIRECRAWL_API_URL', 'https://api.firecrawl.dev')