From a32e16a9bebab9c89aacdb1aa4bce5dfa0976f12 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 25 Apr 2024 11:20:35 -0700 Subject: [PATCH] Nick: added /search to the python sdk --- apps/python-sdk/README.md | 9 ++++++ .../build/lib/firecrawl/firecrawl.py | 26 ++++++++++++++++++ .../python-sdk/dist/firecrawl-py-0.0.5.tar.gz | Bin 3400 -> 0 bytes .../python-sdk/dist/firecrawl-py-0.0.6.tar.gz | Bin 0 -> 3476 bytes .../dist/firecrawl_py-0.0.5-py3-none-any.whl | Bin 2523 -> 0 bytes .../dist/firecrawl_py-0.0.6-py3-none-any.whl | Bin 0 -> 2573 bytes .../__pycache__/__init__.cpython-311.pyc | Bin 241 -> 254 bytes .../__pycache__/firecrawl.cpython-311.pyc | Bin 5892 -> 6997 bytes apps/python-sdk/firecrawl/firecrawl.py | 26 ++++++++++++++++++ .../python-sdk/firecrawl_py.egg-info/PKG-INFO | 4 +-- apps/python-sdk/setup.py | 4 +-- 11 files changed, 65 insertions(+), 4 deletions(-) delete mode 100644 apps/python-sdk/dist/firecrawl-py-0.0.5.tar.gz create mode 100644 apps/python-sdk/dist/firecrawl-py-0.0.6.tar.gz delete mode 100644 apps/python-sdk/dist/firecrawl_py-0.0.5-py3-none-any.whl create mode 100644 apps/python-sdk/dist/firecrawl_py-0.0.6-py3-none-any.whl diff --git a/apps/python-sdk/README.md b/apps/python-sdk/README.md index 0a80202..02ad307 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 Website To 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.py index f1f5e6e..ef3eb53 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.gz deleted file mode 100644 index fab06b75d357414ee3585b4217a022726facd340..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3400 zcmV-O4Y%?iiwFpWmKbIN|7K}&Wn*$-cWfYK4Z)SJ-l4K=LT=g370Ewx6 z&U=QO73FlC&X4ctr&o*yEZzH4z*TVDU)Sv)R@d0xb$i|39{IGl1IR^2Q`mm*VM6aQ zS!8^{M%|-s@A2cK!`@@3*LU5=y@9o7;Jb$@Pnn<6tMDLM9=ML{3_5>`{T~em>hDnf zb$d;l?;Z}_VYl1wxzG+D`hz_(*rokP+>b*le7c}1-7pS@O{d?V{GI;`|KDHt|6Sw% zcjEt#Hu(SElP5<<#{EA~|NrjipAJsmzWn80?SFW9c&q>KyGJYje{j@?{LkH`{XbCu z|Au8Wpcy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%b0?R|0e#M_;2FBiU0Tf4E6Kz zfA#r)e{krU_`g&68=E)r-<SI&La;xb-KYI;fB)NX_5GiR zgQ1E4yMQxD@H|ZL&aI5jyh+YO{C>XtfUgsPYu7TKz{G!Z|Nk)V|GNWo|8L@d@{O;2 zy;J-j^as`Z--bsR|M5tmiT}HhKfeD}N<53>P!wYwA ez<>b*1`HT5V8DO@0|pH29R3H^#4)4*pa1}zUh|~@ diff --git a/apps/python-sdk/dist/firecrawl-py-0.0.6.tar.gz b/apps/python-sdk/dist/firecrawl-py-0.0.6.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..c1b4206e6db72385a8c4bb6b0d84642b749911bb GIT binary patch literal 3476 zcmV;F4QuiriwFq8oGNAl|7K}&Wn*$-cWf-HXy4-XDda*@##mVa ze`TrQadb+0PS<)#SL~G3b;By#rIJ{0@)ZbbeM(-fvt=BSH$VPN=5b1%7GubxS7+9< zc*Twrx`4@+S(b>?PG`ZhWj=HKc-2|4D4?^DQQj$+vL59yUwTSj=thTfU3bh@l!vDT zcIy2Pt6H~obT{~afby`0*cFsp*4ri9*+RG=l!Sbi0{W9|Ni#yjFuoFG9p@yA z38R9CYa(D^!U&B5qNccFGr=<^+OjUrvn0=8JR=x=5FWv-5I?M7z7(KnErW?%FmeU) z0tsof$RUg%t2khxAg$-mUx*`zoMj|Q<4Ybeq)PBr5~?+Ml;u3*mkd9#bWVLHXO!Ql zpYdp+X3iRXLd@b=*29P7EQ0+GLz+Rz1Hy=5psd*FU&*B{`S)ogiB5QOYFX3ibVkL} zf^X&cMoa}ADlWik6%Cf?YReIyq}-^XG%ay2^E6yOpb>y zDf9)g;qKz>(~|#3NiroqSd9RwSKFV@FSavyX7@H(F6a zd!hx<{Olc(qk7Ll~D1*kgY0hN(wRNpmN}0&ROw(5`-YP$} z)wYU>`g2sMqLv4m2bH2g-51*;YL`1Yt+<~O(352xNW0AFdoW7u0o^w>2~9L*S)N9! zix#T#1+s6zedHaSj8oT_4GC&R!>fr~?M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c%`a+>3UGMbCck-Zy2JSv=x;S=e1{cPw2*_zP7`Wkz*Z&}a#` zc8zbOvGk~4cXF%%I)pgojTV+q@Z8PStGKjg?IfxFiqLdOd4$7yNfkud-w3cyQ2l*w zNF7mp{iA3a`qF2u$Qt{(2(d>y8m2Tnn`VDe6cF598hdtWkXS$OBi$0Qwo^Ypv9ypB zBA5X(|77vSzmwf9@a9qZhbu*)uj^)|4){ctVVdLF8%A?Mu(=tJ3-s6g4V1f{=rhFB z7W_hPE-SD{E#vGDwIzyITc&IDCvNa+$~aG2JZ)AKY)G^L6at0(3h~8R!6K{vf4zOpmH{g%NeTz_P59P=!?PSZpn$w1`m7eBIH~Z>U~<9saIFLzr8R= zJ>r+_F^14gWn$I9U9p{*?m*|Nm#-P+h4ImQjPLoJG2ZdDl5&+Z4(@*eikV{14O)6% z8|VQ|$c`!wN^|7$@*9Q5QukgH&Qald9*D znd)=asTGZe+1BFZdcN-!^jnlAH;raJdC`57`gT#e*}>sRu`WBujvfhwfnH~OR}BW* zZ!#Y0+<`D~05c6~7&`|h7?N%%bPL@L?KXMXZPLRPZS6AbSpc&nbPOCim`EB%M_12r zQq&$szaUAMFnX{|4zL!DpiAnpX|SSud4j(vDK+_CG2}BWqT{zeAuVDhiRu$`qXox9WfI}jSsvvY909?W4ZoS z)!5Xcm#<)rABEuKmlOEkJ)if-|9r~Me;YO}_2UiTN5tRt_`d)EK-u}jKOr_@ypI1P z)Fkbl}}D{pJEf9DzP*oOC0>Tl(4P5A$E@AD;Z Z$Nek)Q3xP!Apo$0_xABz^GWF2>_1rH5a0j+ diff --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.whl new file mode 100644 index 0000000000000000000000000000000000000000..5aba56187b34e37ad84764a061ff2b3c769c0bb0 GIT binary patch literal 2573 zcmai$3pmsJAIIk&<&s+@Nm0UVtP9I+SjJq3h_u|A9hqU0OSw(%3@5oI|D{|~hs7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f414e4633ea7297260fe73..7c98fa33cdb39232d3c4b0ad07ee506b91bb20d4 100644 GIT binary patch delta 1088 zcmaKqO-vI}5XbvUyQQ>U+e%CME`sUY&O4{eeXZBGxOf6@7(~u zVKUXJ;8|byUOisF#xGu&g|9~{NfjZYDxwy7QN2ncHDGJNYQSp1YQ-a>4lF0uuBswB zQ4g#Y>wtRE0IU;@K!a!k8bvav@|f4&?2-lciulcbA)A%`+2ve3lkStn>xD05rG`8& zq_sPwkW%jv2Q@|XPW|X!dT2a~lr*bYQAbbAoJ z2oFHk0i4Q1jo?=}rGos?@dTA(RJfHK%VvGbVi!iZSP$psS|3Zr`YtxZmN*R#>=C##g-(#mlqYMWKET=siHCU!P;DGnctVpgIltO z%hqtw7%rUCZIgB<7G#QMGjc9UC77n1qn)ru8xU?bsSlEFwxaLkl&;u@evFJ3KI(sv zU_Zthqt~Rrg$7~MqfrKQ5_45Y)61HTivU?q#22!%aMNPX!bhZ_}`=vTvd z_!UlwL1FAnd+*({ni%BUe;jLU^&+6AWA7(VMA)D9Z1()_A1`($a zIDU#lQd$b27i14?ZR9Q6unpTB+6D4eb%<=+#thXVV?}g^-L*T&EPH5oPu?WtHU#|J Od{g#z|0AJ1Wc>-C92l_x delta 623 zcmaJ-O-mbL5Z+04H(;{c7&Twee7R}dm3+_yYq32Dp`u`0@D`<^bl0Hx5#NoVl=fnN zfMLM?fkN*twAc2~YiSQ6#7pU=1urdlmd+?ekhbsPnVDzid6;>RCb}j4jiwDq^jZh; zqdPf@mYTcxPjfv(hhomF5#GH>)gpTR7CgtEWb z-t}bPOFx+2p7IU6Zm@Cg)A4CVq;M7voD@2fF999&j2 zJeI{&WDH6;6G_7~wj$3jX#;;maxjU(p%m0TYv?_|1fC8Hu<*%9xqgSFW}q*3R@NOc z$v#(?j8fTG+%?B(i;L9)*H^pEf;xT~sX`f*XdY&~@#tgUy(`NU*?&faPOiTJ#Da^J diff --git a/apps/python-sdk/firecrawl/firecrawl.py b/apps/python-sdk/firecrawl/firecrawl.py index f1f5e6e..ef3eb53 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-INFO index ad0bd09..61589c2 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.1 Name: firecrawl-py -Version: 0.0.5 +Version: 0.0.6 Summary: Python SDK for Firecrawl API -Home-page: https://github.com/mendableai/firecrawl-py +Home-page: https://github.com/mendableai/firecrawl Author: Mendable.ai Author-email: nick@mendable.ai diff --git a/apps/python-sdk/setup.py b/apps/python-sdk/setup.py index d2fc6b8..a3589e3 100644 --- a/apps/python-sdk/setup.py +++ b/apps/python-sdk/setup.py @@ -2,8 +2,8 @@ from setuptools import setup, find_packages setup( 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='nick@mendable.ai', description='Python SDK for Firecrawl API',