Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
Nick: added /search to the python sdk
Nicolasa32e16a9beba
diff --git a/apps/python-sdk/README.md b/apps/python-sdk/README.mdindex 0a802028b..02ad3079d 100644--- a/apps/python-sdk/README.md+++ b/apps/python-sdk/README.md@@ -47,6 +47,15 @@ url = 'https://example.com'scraped_data = app.scrape_url(url)```+### Search for a query++Used to search the web, get the most relevant results, scrap each page and return the markdown.++```python+query = 'what is mendable?'+search_result = app.search(query)+```+### Crawling a WebsiteTo crawl a website, use the `crawl_url` method. It takes the starting URL and optional parameters as arguments. The `params` argument allows you to specify additional options for the crawl job, such as the maximum number of pages to crawl, allowed domains, and the output format.diff --git a/apps/python-sdk/build/lib/firecrawl/firecrawl.py b/apps/python-sdk/build/lib/firecrawl/firecrawl.pyindex f1f5e6e4e..ef3eb532e 100644--- a/apps/python-sdk/build/lib/firecrawl/firecrawl.py+++ b/apps/python-sdk/build/lib/firecrawl/firecrawl.py@@ -32,6 +32,32 @@ class FirecrawlApp:raise Exception(f'Failed to scrape URL. Status code: {response.status_code}. Error: {error_message}')else:raise Exception(f'Failed to scrape URL. Status code: {response.status_code}')++ def search(self, query, params=None):+ headers = {+ 'Content-Type': 'application/json',+ 'Authorization': f'Bearer {self.api_key}'+ }+ json_data = {'query': query}+ if params:+ json_data.update(params)+ response = requests.post(+ 'https://api.firecrawl.dev/v0/search',+ headers=headers,+ json=json_data+ )+ if response.status_code == 200:+ response = response.json()+ if response['success'] == True:+ return response['data']+ else:+ raise Exception(f'Failed to search. Error: {response["error"]}')++ elif response.status_code in [402, 409, 500]:+ error_message = response.json().get('error', 'Unknown error occurred')+ raise Exception(f'Failed to search. Status code: {response.status_code}. Error: {error_message}')+ else:+ raise Exception(f'Failed to search. Status code: {response.status_code}')def crawl_url(self, url, params=None, wait_until_done=True, timeout=2):headers = self._prepare_headers()diff --git a/apps/python-sdk/dist/firecrawl-py-0.0.5.tar.gz b/apps/python-sdk/dist/firecrawl-py-0.0.5.tar.gzdeleted file mode 100644index fab06b75d..000000000Binary files a/apps/python-sdk/dist/firecrawl-py-0.0.5.tar.gz and /dev/null differdiff --git a/apps/python-sdk/dist/firecrawl-py-0.0.6.tar.gz b/apps/python-sdk/dist/firecrawl-py-0.0.6.tar.gznew file mode 100644index 000000000..c1b4206e6Binary files /dev/null and b/apps/python-sdk/dist/firecrawl-py-0.0.6.tar.gz differdiff --git a/apps/python-sdk/dist/firecrawl_py-0.0.5-py3-none-any.whl b/apps/python-sdk/dist/firecrawl_py-0.0.5-py3-none-any.whldeleted file mode 100644index b32d0c82e..000000000Binary files a/apps/python-sdk/dist/firecrawl_py-0.0.5-py3-none-any.whl and /dev/null differdiff --git a/apps/python-sdk/dist/firecrawl_py-0.0.6-py3-none-any.whl b/apps/python-sdk/dist/firecrawl_py-0.0.6-py3-none-any.whlnew file mode 100644index 000000000..5aba56187Binary files /dev/null and b/apps/python-sdk/dist/firecrawl_py-0.0.6-py3-none-any.whl differdiff --git a/apps/python-sdk/firecrawl/__pycache__/__init__.cpython-311.pyc b/apps/python-sdk/firecrawl/__pycache__/__init__.cpython-311.pycindex 4926b8084..605b3df71 100644Binary files a/apps/python-sdk/firecrawl/__pycache__/__init__.cpython-311.pyc and b/apps/python-sdk/firecrawl/__pycache__/__init__.cpython-311.pyc differdiff --git a/apps/python-sdk/firecrawl/__pycache__/firecrawl.cpython-311.pyc b/apps/python-sdk/firecrawl/__pycache__/firecrawl.cpython-311.pycindex 694553e2f..7c98fa33c 100644Binary files a/apps/python-sdk/firecrawl/__pycache__/firecrawl.cpython-311.pyc and b/apps/python-sdk/firecrawl/__pycache__/firecrawl.cpython-311.pyc differdiff --git a/apps/python-sdk/firecrawl/firecrawl.py b/apps/python-sdk/firecrawl/firecrawl.pyindex f1f5e6e4e..ef3eb532e 100644--- a/apps/python-sdk/firecrawl/firecrawl.py+++ b/apps/python-sdk/firecrawl/firecrawl.py@@ -32,6 +32,32 @@ class FirecrawlApp:raise Exception(f'Failed to scrape URL. Status code: {response.status_code}. Error: {error_message}')else:raise Exception(f'Failed to scrape URL. Status code: {response.status_code}')++ def search(self, query, params=None):+ headers = {+ 'Content-Type': 'application/json',+ 'Authorization': f'Bearer {self.api_key}'+ }+ json_data = {'query': query}+ if params:+ json_data.update(params)+ response = requests.post(+ 'https://api.firecrawl.dev/v0/search',+ headers=headers,+ json=json_data+ )+ if response.status_code == 200:+ response = response.json()+ if response['success'] == True:+ return response['data']+ else:+ raise Exception(f'Failed to search. Error: {response["error"]}')++ elif response.status_code in [402, 409, 500]:+ error_message = response.json().get('error', 'Unknown error occurred')+ raise Exception(f'Failed to search. Status code: {response.status_code}. Error: {error_message}')+ else:+ raise Exception(f'Failed to search. Status code: {response.status_code}')def crawl_url(self, url, params=None, wait_until_done=True, timeout=2):headers = self._prepare_headers()diff --git a/apps/python-sdk/firecrawl_py.egg-info/PKG-INFO b/apps/python-sdk/firecrawl_py.egg-info/PKG-INFOindex ad0bd09c8..61589c224 100644--- a/apps/python-sdk/firecrawl_py.egg-info/PKG-INFO+++ b/apps/python-sdk/firecrawl_py.egg-info/PKG-INFO@@ -1,7 +1,7 @@Metadata-Version: 2.1Name: firecrawl-py-Version: 0.0.5+Version: 0.0.6Summary: Python SDK for Firecrawl API-Home-page: https://github.com/mendableai/firecrawl-py+Home-page: https://github.com/mendableai/firecrawlAuthor: Mendable.aiAuthor-email: [email protected]diff --git a/apps/python-sdk/setup.py b/apps/python-sdk/setup.pyindex d2fc6b81e..a3589e343 100644--- a/apps/python-sdk/setup.py+++ b/apps/python-sdk/setup.py@@ -2,8 +2,8 @@ from setuptools import setup, find_packagessetup(name='firecrawl-py',- version='0.0.5',- url='https://github.com/mendableai/firecrawl-py',+ version='0.0.6',+ url='https://github.com/mendableai/firecrawl',author='Mendable.ai',author_email='[email protected]',description='Python SDK for Firecrawl API',