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
1 changed files with 2 additions and 2 deletions

View File

@ -4,11 +4,11 @@ import requests
import time import time
class FirecrawlApp: 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') self.api_key = api_key or os.getenv('FIRECRAWL_API_KEY')
if self.api_key is None: if self.api_key is None:
raise ValueError('No API key provided') 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')