From aaef1d71e4c52adc5338d7d469daea298c5938a9 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Sun, 12 Jan 2025 00:07:49 +0000 Subject: [PATCH] SDK regeneration --- poetry.lock | 131 ++++++++- pyproject.toml | 3 +- reference.md | 171 ----------- src/scrapybara/__init__.py | 9 +- src/scrapybara/agent/__init__.py | 5 - src/scrapybara/agent/client.py | 364 ------------------------ src/scrapybara/agent/types/__init__.py | 5 - src/scrapybara/agent/types/model.py | 5 - src/scrapybara/base_client.py | 4 - src/scrapybara/core/client_wrapper.py | 2 +- src/scrapybara/types/__init__.py | 4 - src/scrapybara/types/act_response.py | 20 -- src/scrapybara/types/scrape_response.py | 20 -- 13 files changed, 131 insertions(+), 612 deletions(-) delete mode 100644 src/scrapybara/agent/__init__.py delete mode 100644 src/scrapybara/agent/client.py delete mode 100644 src/scrapybara/agent/types/__init__.py delete mode 100644 src/scrapybara/agent/types/model.py delete mode 100644 src/scrapybara/types/act_response.py delete mode 100644 src/scrapybara/types/scrape_response.py diff --git a/poetry.lock b/poetry.lock index 2daf4a8..659e929 100644 --- a/poetry.lock +++ b/poetry.lock @@ -107,6 +107,92 @@ files = [ [package.extras] test = ["pytest (>=6)"] +[[package]] +name = "greenlet" +version = "3.1.1" +description = "Lightweight in-process concurrent programming" +optional = false +python-versions = ">=3.7" +files = [ + {file = "greenlet-3.1.1-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:0bbae94a29c9e5c7e4a2b7f0aae5c17e8e90acbfd3bf6270eeba60c39fce3563"}, + {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0fde093fb93f35ca72a556cf72c92ea3ebfda3d79fc35bb19fbe685853869a83"}, + {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:36b89d13c49216cadb828db8dfa6ce86bbbc476a82d3a6c397f0efae0525bdd0"}, + {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:94b6150a85e1b33b40b1464a3f9988dcc5251d6ed06842abff82e42632fac120"}, + {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93147c513fac16385d1036b7e5b102c7fbbdb163d556b791f0f11eada7ba65dc"}, + {file = "greenlet-3.1.1-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:da7a9bff22ce038e19bf62c4dd1ec8391062878710ded0a845bcf47cc0200617"}, + {file = "greenlet-3.1.1-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:b2795058c23988728eec1f36a4e5e4ebad22f8320c85f3587b539b9ac84128d7"}, + {file = "greenlet-3.1.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:ed10eac5830befbdd0c32f83e8aa6288361597550ba669b04c48f0f9a2c843c6"}, + {file = "greenlet-3.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:77c386de38a60d1dfb8e55b8c1101d68c79dfdd25c7095d51fec2dd800892b80"}, + {file = "greenlet-3.1.1-cp311-cp311-macosx_11_0_universal2.whl", hash = "sha256:e4d333e558953648ca09d64f13e6d8f0523fa705f51cae3f03b5983489958c70"}, + {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:09fc016b73c94e98e29af67ab7b9a879c307c6731a2c9da0db5a7d9b7edd1159"}, + {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d5e975ca70269d66d17dd995dafc06f1b06e8cb1ec1e9ed54c1d1e4a7c4cf26e"}, + {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3b2813dc3de8c1ee3f924e4d4227999285fd335d1bcc0d2be6dc3f1f6a318ec1"}, + {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e347b3bfcf985a05e8c0b7d462ba6f15b1ee1c909e2dcad795e49e91b152c383"}, + {file = "greenlet-3.1.1-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:9e8f8c9cb53cdac7ba9793c276acd90168f416b9ce36799b9b885790f8ad6c0a"}, + {file = "greenlet-3.1.1-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:62ee94988d6b4722ce0028644418d93a52429e977d742ca2ccbe1c4f4a792511"}, + {file = "greenlet-3.1.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:1776fd7f989fc6b8d8c8cb8da1f6b82c5814957264d1f6cf818d475ec2bf6395"}, + {file = "greenlet-3.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:48ca08c771c268a768087b408658e216133aecd835c0ded47ce955381105ba39"}, + {file = "greenlet-3.1.1-cp312-cp312-macosx_11_0_universal2.whl", hash = "sha256:4afe7ea89de619adc868e087b4d2359282058479d7cfb94970adf4b55284574d"}, + {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f406b22b7c9a9b4f8aa9d2ab13d6ae0ac3e85c9a809bd590ad53fed2bf70dc79"}, + {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c3a701fe5a9695b238503ce5bbe8218e03c3bcccf7e204e455e7462d770268aa"}, + {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:2846930c65b47d70b9d178e89c7e1a69c95c1f68ea5aa0a58646b7a96df12441"}, + {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:99cfaa2110534e2cf3ba31a7abcac9d328d1d9f1b95beede58294a60348fba36"}, + {file = "greenlet-3.1.1-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1443279c19fca463fc33e65ef2a935a5b09bb90f978beab37729e1c3c6c25fe9"}, + {file = "greenlet-3.1.1-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:b7cede291382a78f7bb5f04a529cb18e068dd29e0fb27376074b6d0317bf4dd0"}, + {file = "greenlet-3.1.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:23f20bb60ae298d7d8656c6ec6db134bca379ecefadb0b19ce6f19d1f232a942"}, + {file = "greenlet-3.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:7124e16b4c55d417577c2077be379514321916d5790fa287c9ed6f23bd2ffd01"}, + {file = "greenlet-3.1.1-cp313-cp313-macosx_11_0_universal2.whl", hash = "sha256:05175c27cb459dcfc05d026c4232f9de8913ed006d42713cb8a5137bd49375f1"}, + {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:935e943ec47c4afab8965954bf49bfa639c05d4ccf9ef6e924188f762145c0ff"}, + {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:667a9706c970cb552ede35aee17339a18e8f2a87a51fba2ed39ceeeb1004798a"}, + {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b8a678974d1f3aa55f6cc34dc480169d58f2e6d8958895d68845fa4ab566509e"}, + {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:efc0f674aa41b92da8c49e0346318c6075d734994c3c4e4430b1c3f853e498e4"}, + {file = "greenlet-3.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0153404a4bb921f0ff1abeb5ce8a5131da56b953eda6e14b88dc6bbc04d2049e"}, + {file = "greenlet-3.1.1-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:275f72decf9932639c1c6dd1013a1bc266438eb32710016a1c742df5da6e60a1"}, + {file = "greenlet-3.1.1-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:c4aab7f6381f38a4b42f269057aee279ab0fc7bf2e929e3d4abfae97b682a12c"}, + {file = "greenlet-3.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:b42703b1cf69f2aa1df7d1030b9d77d3e584a70755674d60e710f0af570f3761"}, + {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f1695e76146579f8c06c1509c7ce4dfe0706f49c6831a817ac04eebb2fd02011"}, + {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:7876452af029456b3f3549b696bb36a06db7c90747740c5302f74a9e9fa14b13"}, + {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:4ead44c85f8ab905852d3de8d86f6f8baf77109f9da589cb4fa142bd3b57b475"}, + {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8320f64b777d00dd7ccdade271eaf0cad6636343293a25074cc5566160e4de7b"}, + {file = "greenlet-3.1.1-cp313-cp313t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:6510bf84a6b643dabba74d3049ead221257603a253d0a9873f55f6a59a65f822"}, + {file = "greenlet-3.1.1-cp313-cp313t-musllinux_1_1_aarch64.whl", hash = "sha256:04b013dc07c96f83134b1e99888e7a79979f1a247e2a9f59697fa14b5862ed01"}, + {file = "greenlet-3.1.1-cp313-cp313t-musllinux_1_1_x86_64.whl", hash = "sha256:411f015496fec93c1c8cd4e5238da364e1da7a124bcb293f085bf2860c32c6f6"}, + {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:47da355d8687fd65240c364c90a31569a133b7b60de111c255ef5b606f2ae291"}, + {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:98884ecf2ffb7d7fe6bd517e8eb99d31ff7855a840fa6d0d63cd07c037f6a981"}, + {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:f1d4aeb8891338e60d1ab6127af1fe45def5259def8094b9c7e34690c8858803"}, + {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:db32b5348615a04b82240cc67983cb315309e88d444a288934ee6ceaebcad6cc"}, + {file = "greenlet-3.1.1-cp37-cp37m-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:dcc62f31eae24de7f8dce72134c8651c58000d3b1868e01392baea7c32c247de"}, + {file = "greenlet-3.1.1-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:1d3755bcb2e02de341c55b4fca7a745a24a9e7212ac953f6b3a48d117d7257aa"}, + {file = "greenlet-3.1.1-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:b8da394b34370874b4572676f36acabac172602abf054cbc4ac910219f3340af"}, + {file = "greenlet-3.1.1-cp37-cp37m-win32.whl", hash = "sha256:a0dfc6c143b519113354e780a50381508139b07d2177cb6ad6a08278ec655798"}, + {file = "greenlet-3.1.1-cp37-cp37m-win_amd64.whl", hash = "sha256:54558ea205654b50c438029505def3834e80f0869a70fb15b871c29b4575ddef"}, + {file = "greenlet-3.1.1-cp38-cp38-macosx_11_0_universal2.whl", hash = "sha256:346bed03fe47414091be4ad44786d1bd8bef0c3fcad6ed3dee074a032ab408a9"}, + {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dfc59d69fc48664bc693842bd57acfdd490acafda1ab52c7836e3fc75c90a111"}, + {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d21e10da6ec19b457b82636209cbe2331ff4306b54d06fa04b7c138ba18c8a81"}, + {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:37b9de5a96111fc15418819ab4c4432e4f3c2ede61e660b1e33971eba26ef9ba"}, + {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6ef9ea3f137e5711f0dbe5f9263e8c009b7069d8a1acea822bd5e9dae0ae49c8"}, + {file = "greenlet-3.1.1-cp38-cp38-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:85f3ff71e2e60bd4b4932a043fbbe0f499e263c628390b285cb599154a3b03b1"}, + {file = "greenlet-3.1.1-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:95ffcf719966dd7c453f908e208e14cde192e09fde6c7186c8f1896ef778d8cd"}, + {file = "greenlet-3.1.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:03a088b9de532cbfe2ba2034b2b85e82df37874681e8c470d6fb2f8c04d7e4b7"}, + {file = "greenlet-3.1.1-cp38-cp38-win32.whl", hash = "sha256:8b8b36671f10ba80e159378df9c4f15c14098c4fd73a36b9ad715f057272fbef"}, + {file = "greenlet-3.1.1-cp38-cp38-win_amd64.whl", hash = "sha256:7017b2be767b9d43cc31416aba48aab0d2309ee31b4dbf10a1d38fb7972bdf9d"}, + {file = "greenlet-3.1.1-cp39-cp39-macosx_11_0_universal2.whl", hash = "sha256:396979749bd95f018296af156201d6211240e7a23090f50a8d5d18c370084dc3"}, + {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ca9d0ff5ad43e785350894d97e13633a66e2b50000e8a183a50a88d834752d42"}, + {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f6ff3b14f2df4c41660a7dec01045a045653998784bf8cfcb5a525bdffffbc8f"}, + {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:94ebba31df2aa506d7b14866fed00ac141a867e63143fe5bca82a8e503b36437"}, + {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:73aaad12ac0ff500f62cebed98d8789198ea0e6f233421059fa68a5aa7220145"}, + {file = "greenlet-3.1.1-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:63e4844797b975b9af3a3fb8f7866ff08775f5426925e1e0bbcfe7932059a12c"}, + {file = "greenlet-3.1.1-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:7939aa3ca7d2a1593596e7ac6d59391ff30281ef280d8632fa03d81f7c5f955e"}, + {file = "greenlet-3.1.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:d0028e725ee18175c6e422797c407874da24381ce0690d6b9396c204c7f7276e"}, + {file = "greenlet-3.1.1-cp39-cp39-win32.whl", hash = "sha256:5e06afd14cbaf9e00899fae69b24a32f2196c19de08fcb9f4779dd4f004e5e7c"}, + {file = "greenlet-3.1.1-cp39-cp39-win_amd64.whl", hash = "sha256:3319aa75e0e0639bc15ff54ca327e8dc7a6fe404003496e3c6925cd3142e0e22"}, + {file = "greenlet-3.1.1.tar.gz", hash = "sha256:4ce3ac6cdb6adf7946475d7ef31777c26d94bccc377e070a7986bd2d5c515467"}, +] + +[package.extras] +docs = ["Sphinx", "furo"] +test = ["objgraph", "psutil"] + [[package]] name = "h11" version = "0.14.0" @@ -341,6 +427,26 @@ files = [ {file = "packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f"}, ] +[[package]] +name = "playwright" +version = "1.48.0" +description = "A high-level API to automate web browsers" +optional = false +python-versions = ">=3.8" +files = [ + {file = "playwright-1.48.0-py3-none-macosx_10_13_x86_64.whl", hash = "sha256:082bce2739f1078acc7d0734da8cc0e23eb91b7fae553f3316d733276f09a6b1"}, + {file = "playwright-1.48.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:7da2eb51a19c7f3b523e9faa9d98e7af92e52eb983a099979ea79c9668e3cbf7"}, + {file = "playwright-1.48.0-py3-none-macosx_11_0_universal2.whl", hash = "sha256:115b988d1da322358b77bc3bf2d3cc90f8c881e691461538e7df91614c4833c9"}, + {file = "playwright-1.48.0-py3-none-manylinux1_x86_64.whl", hash = "sha256:8dabb80e62f667fe2640a8b694e26a7b884c0b4803f7514a3954fc849126227b"}, + {file = "playwright-1.48.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8ff8303409ebed76bed4c3d655340320b768817d900ba208b394fdd7d7939a5c"}, + {file = "playwright-1.48.0-py3-none-win32.whl", hash = "sha256:85598c360c590076d4f435525be991246d74a905b654ac19d26eab7ed9b98b2d"}, + {file = "playwright-1.48.0-py3-none-win_amd64.whl", hash = "sha256:e0e87b0c4dc8fce83c725dd851aec37bc4e882bb225ec8a96bd83cf32d4f1623"}, +] + +[package.dependencies] +greenlet = "3.1.1" +pyee = "12.0.0" + [[package]] name = "pluggy" version = "1.5.0" @@ -358,13 +464,13 @@ testing = ["pytest", "pytest-benchmark"] [[package]] name = "pydantic" -version = "2.10.4" +version = "2.10.5" description = "Data validation using Python type hints" optional = false python-versions = ">=3.8" files = [ - {file = "pydantic-2.10.4-py3-none-any.whl", hash = "sha256:597e135ea68be3a37552fb524bc7d0d66dcf93d395acd93a00682f1efcb8ee3d"}, - {file = "pydantic-2.10.4.tar.gz", hash = "sha256:82f12e9723da6de4fe2ba888b5971157b3be7ad914267dea8f05f82b28254f06"}, + {file = "pydantic-2.10.5-py3-none-any.whl", hash = "sha256:4dd4e322dbe55472cb7ca7e73f4b63574eecccf2835ffa2af9021ce113c83c53"}, + {file = "pydantic-2.10.5.tar.gz", hash = "sha256:278b38dbbaec562011d659ee05f63346951b3a248a6f3642e1bc68894ea2b4ff"}, ] [package.dependencies] @@ -488,6 +594,23 @@ files = [ [package.dependencies] typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" +[[package]] +name = "pyee" +version = "12.0.0" +description = "A rough port of Node.js's EventEmitter to Python with a few tricks of its own" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pyee-12.0.0-py3-none-any.whl", hash = "sha256:7b14b74320600049ccc7d0e0b1becd3b4bd0a03c745758225e31a59f4095c990"}, + {file = "pyee-12.0.0.tar.gz", hash = "sha256:c480603f4aa2927d4766eb41fa82793fe60a82cbfdb8d688e0d08c55a534e145"}, +] + +[package.dependencies] +typing-extensions = "*" + +[package.extras] +dev = ["black", "build", "flake8", "flake8-black", "isort", "jupyter-console", "mkdocs", "mkdocs-include-markdown-plugin", "mkdocstrings[python]", "pytest", "pytest-asyncio", "pytest-trio", "sphinx", "toml", "tox", "trio", "trio", "trio-typing", "twine", "twisted", "validate-pyproject[all]"] + [[package]] name = "pytest" version = "7.4.4" @@ -657,4 +780,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "13de834176e26d7becf87fce47d73d025fed246396db1afb1ab21e59e69350b4" +content-hash = "8130552a641501ad4537fd8c8eec56deb0b111b9da63b6460974bd12d106ff5a" diff --git a/pyproject.toml b/pyproject.toml index 6a6900a..178562f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "scrapybara" -version = "2.0.7" +version = "2.1.0" description = "" readme = "README.md" authors = [] @@ -34,6 +34,7 @@ Repository = 'https://github.com/scrapybara/scrapybara-python' python = "^3.8" anthropic = "^0.39.0" httpx = ">=0.21.2" +playwright = "^1.48.0" pydantic = ">= 1.9.2" pydantic-core = "^2.18.2" typing_extensions = ">= 4.0.0" diff --git a/reference.md b/reference.md index 778f83f..a16e22d 100644 --- a/reference.md +++ b/reference.md @@ -761,177 +761,6 @@ client.instance.resume( - - - - -## Agent -
client.agent.act(...) -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from scrapybara import Scrapybara - -client = Scrapybara( - api_key="YOUR_API_KEY", -) -client.agent.act( - instance_id="instance_id", - cmd="cmd", -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**instance_id:** `str` - -
-
- -
-
- -**cmd:** `str` - -
-
- -
-
- -**include_screenshot:** `typing.Optional[bool]` - -
-
- -
-
- -**model:** `typing.Optional[Model]` - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- - -
-
-
- -
client.agent.scrape(...) -
-
- -#### 🔌 Usage - -
-
- -
-
- -```python -from scrapybara import Scrapybara - -client = Scrapybara( - api_key="YOUR_API_KEY", -) -client.agent.scrape( - instance_id="instance_id", - cmd="cmd", -) - -``` -
-
-
-
- -#### ⚙️ Parameters - -
-
- -
-
- -**instance_id:** `str` - -
-
- -
-
- -**cmd:** `str` - -
-
- -
-
- -**schema:** `typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]]` - -
-
- -
-
- -**include_screenshot:** `typing.Optional[bool]` - -
-
- -
-
- -**model:** `typing.Optional[Model]` - -
-
- -
-
- -**request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration. - -
-
-
-
- -
diff --git a/src/scrapybara/__init__.py b/src/scrapybara/__init__.py index 91c8291..03f549c 100644 --- a/src/scrapybara/__init__.py +++ b/src/scrapybara/__init__.py @@ -1,7 +1,6 @@ # This file was auto-generated by Fern from our API Definition. from .types import ( - ActResponse, AuthStateResponse, BrowserAuthenticateResponse, BrowserGetCdpUrlResponse, @@ -20,7 +19,6 @@ Notebook, NotebookCell, SaveBrowserAuthResponse, - ScrapeResponse, StartBrowserResponse, Status, StopBrowserResponse, @@ -29,15 +27,13 @@ ValidationErrorLocItem, ) from .errors import UnprocessableEntityError -from . import agent, browser, code, env, file, instance, notebook -from .agent import Model +from . import browser, code, env, file, instance, notebook from .client import AsyncScrapybara, Scrapybara from .environment import ScrapybaraEnvironment from .instance import Action, Command from .version import __version__ __all__ = [ - "ActResponse", "Action", "AsyncScrapybara", "AuthStateResponse", @@ -56,11 +52,9 @@ "InstanceGetStreamUrlResponse", "InstanceScreenshotResponse", "KernelInfo", - "Model", "Notebook", "NotebookCell", "SaveBrowserAuthResponse", - "ScrapeResponse", "Scrapybara", "ScrapybaraEnvironment", "StartBrowserResponse", @@ -71,7 +65,6 @@ "ValidationError", "ValidationErrorLocItem", "__version__", - "agent", "browser", "code", "env", diff --git a/src/scrapybara/agent/__init__.py b/src/scrapybara/agent/__init__.py deleted file mode 100644 index b1f769f..0000000 --- a/src/scrapybara/agent/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .types import Model - -__all__ = ["Model"] diff --git a/src/scrapybara/agent/client.py b/src/scrapybara/agent/client.py deleted file mode 100644 index fb3ac5f..0000000 --- a/src/scrapybara/agent/client.py +++ /dev/null @@ -1,364 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing -from ..core.client_wrapper import SyncClientWrapper -from .types.model import Model -from ..core.request_options import RequestOptions -from ..types.act_response import ActResponse -from ..core.jsonable_encoder import jsonable_encoder -from ..core.pydantic_utilities import parse_obj_as -from ..errors.unprocessable_entity_error import UnprocessableEntityError -from ..types.http_validation_error import HttpValidationError -from json.decoder import JSONDecodeError -from ..core.api_error import ApiError -from ..types.scrape_response import ScrapeResponse -from ..core.client_wrapper import AsyncClientWrapper - -# this is used as the default value for optional parameters -OMIT = typing.cast(typing.Any, ...) - - -class AgentClient: - def __init__(self, *, client_wrapper: SyncClientWrapper): - self._client_wrapper = client_wrapper - - def act( - self, - instance_id: str, - *, - cmd: str, - include_screenshot: typing.Optional[bool] = OMIT, - model: typing.Optional[Model] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ActResponse: - """ - Parameters - ---------- - instance_id : str - - cmd : str - - include_screenshot : typing.Optional[bool] - - model : typing.Optional[Model] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ActResponse - Successful Response - - Examples - -------- - from scrapybara import Scrapybara - - client = Scrapybara( - api_key="YOUR_API_KEY", - ) - client.agent.act( - instance_id="instance_id", - cmd="cmd", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"v1/instance/{jsonable_encoder(instance_id)}/act", - method="POST", - json={ - "cmd": cmd, - "include_screenshot": include_screenshot, - "model": model, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - return typing.cast( - ActResponse, - parse_obj_as( - type_=ActResponse, # type: ignore - object_=_response.json(), - ), - ) - if _response.status_code == 422: - raise UnprocessableEntityError( - typing.cast( - HttpValidationError, - parse_obj_as( - type_=HttpValidationError, # type: ignore - object_=_response.json(), - ), - ) - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - def scrape( - self, - instance_id: str, - *, - cmd: str, - schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, - include_screenshot: typing.Optional[bool] = OMIT, - model: typing.Optional[Model] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ScrapeResponse: - """ - Parameters - ---------- - instance_id : str - - cmd : str - - schema : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] - - include_screenshot : typing.Optional[bool] - - model : typing.Optional[Model] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ScrapeResponse - Successful Response - - Examples - -------- - from scrapybara import Scrapybara - - client = Scrapybara( - api_key="YOUR_API_KEY", - ) - client.agent.scrape( - instance_id="instance_id", - cmd="cmd", - ) - """ - _response = self._client_wrapper.httpx_client.request( - f"v1/instance/{jsonable_encoder(instance_id)}/scrape", - method="POST", - json={ - "cmd": cmd, - "schema": schema, - "include_screenshot": include_screenshot, - "model": model, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - return typing.cast( - ScrapeResponse, - parse_obj_as( - type_=ScrapeResponse, # type: ignore - object_=_response.json(), - ), - ) - if _response.status_code == 422: - raise UnprocessableEntityError( - typing.cast( - HttpValidationError, - parse_obj_as( - type_=HttpValidationError, # type: ignore - object_=_response.json(), - ), - ) - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - -class AsyncAgentClient: - def __init__(self, *, client_wrapper: AsyncClientWrapper): - self._client_wrapper = client_wrapper - - async def act( - self, - instance_id: str, - *, - cmd: str, - include_screenshot: typing.Optional[bool] = OMIT, - model: typing.Optional[Model] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ActResponse: - """ - Parameters - ---------- - instance_id : str - - cmd : str - - include_screenshot : typing.Optional[bool] - - model : typing.Optional[Model] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ActResponse - Successful Response - - Examples - -------- - import asyncio - - from scrapybara import AsyncScrapybara - - client = AsyncScrapybara( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.agent.act( - instance_id="instance_id", - cmd="cmd", - ) - - - asyncio.run(main()) - """ - _response = await self._client_wrapper.httpx_client.request( - f"v1/instance/{jsonable_encoder(instance_id)}/act", - method="POST", - json={ - "cmd": cmd, - "include_screenshot": include_screenshot, - "model": model, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - return typing.cast( - ActResponse, - parse_obj_as( - type_=ActResponse, # type: ignore - object_=_response.json(), - ), - ) - if _response.status_code == 422: - raise UnprocessableEntityError( - typing.cast( - HttpValidationError, - parse_obj_as( - type_=HttpValidationError, # type: ignore - object_=_response.json(), - ), - ) - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) - - async def scrape( - self, - instance_id: str, - *, - cmd: str, - schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = OMIT, - include_screenshot: typing.Optional[bool] = OMIT, - model: typing.Optional[Model] = OMIT, - request_options: typing.Optional[RequestOptions] = None, - ) -> ScrapeResponse: - """ - Parameters - ---------- - instance_id : str - - cmd : str - - schema : typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] - - include_screenshot : typing.Optional[bool] - - model : typing.Optional[Model] - - request_options : typing.Optional[RequestOptions] - Request-specific configuration. - - Returns - ------- - ScrapeResponse - Successful Response - - Examples - -------- - import asyncio - - from scrapybara import AsyncScrapybara - - client = AsyncScrapybara( - api_key="YOUR_API_KEY", - ) - - - async def main() -> None: - await client.agent.scrape( - instance_id="instance_id", - cmd="cmd", - ) - - - asyncio.run(main()) - """ - _response = await self._client_wrapper.httpx_client.request( - f"v1/instance/{jsonable_encoder(instance_id)}/scrape", - method="POST", - json={ - "cmd": cmd, - "schema": schema, - "include_screenshot": include_screenshot, - "model": model, - }, - headers={ - "content-type": "application/json", - }, - request_options=request_options, - omit=OMIT, - ) - try: - if 200 <= _response.status_code < 300: - return typing.cast( - ScrapeResponse, - parse_obj_as( - type_=ScrapeResponse, # type: ignore - object_=_response.json(), - ), - ) - if _response.status_code == 422: - raise UnprocessableEntityError( - typing.cast( - HttpValidationError, - parse_obj_as( - type_=HttpValidationError, # type: ignore - object_=_response.json(), - ), - ) - ) - _response_json = _response.json() - except JSONDecodeError: - raise ApiError(status_code=_response.status_code, body=_response.text) - raise ApiError(status_code=_response.status_code, body=_response_json) diff --git a/src/scrapybara/agent/types/__init__.py b/src/scrapybara/agent/types/__init__.py deleted file mode 100644 index dce9230..0000000 --- a/src/scrapybara/agent/types/__init__.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from .model import Model - -__all__ = ["Model"] diff --git a/src/scrapybara/agent/types/model.py b/src/scrapybara/agent/types/model.py deleted file mode 100644 index 5949ec8..0000000 --- a/src/scrapybara/agent/types/model.py +++ /dev/null @@ -1,5 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -import typing - -Model = typing.Union[typing.Literal["claude", "gemini"], typing.Any] diff --git a/src/scrapybara/base_client.py b/src/scrapybara/base_client.py index c2e37de..44799b9 100644 --- a/src/scrapybara/base_client.py +++ b/src/scrapybara/base_client.py @@ -7,7 +7,6 @@ from .core.api_error import ApiError from .core.client_wrapper import SyncClientWrapper from .instance.client import InstanceClient -from .agent.client import AgentClient from .browser.client import BrowserClient from .code.client import CodeClient from .notebook.client import NotebookClient @@ -24,7 +23,6 @@ from .types.auth_state_response import AuthStateResponse from .core.client_wrapper import AsyncClientWrapper from .instance.client import AsyncInstanceClient -from .agent.client import AsyncAgentClient from .browser.client import AsyncBrowserClient from .code.client import AsyncCodeClient from .notebook.client import AsyncNotebookClient @@ -98,7 +96,6 @@ def __init__( timeout=_defaulted_timeout, ) self.instance = InstanceClient(client_wrapper=self._client_wrapper) - self.agent = AgentClient(client_wrapper=self._client_wrapper) self.browser = BrowserClient(client_wrapper=self._client_wrapper) self.code = CodeClient(client_wrapper=self._client_wrapper) self.notebook = NotebookClient(client_wrapper=self._client_wrapper) @@ -375,7 +372,6 @@ def __init__( timeout=_defaulted_timeout, ) self.instance = AsyncInstanceClient(client_wrapper=self._client_wrapper) - self.agent = AsyncAgentClient(client_wrapper=self._client_wrapper) self.browser = AsyncBrowserClient(client_wrapper=self._client_wrapper) self.code = AsyncCodeClient(client_wrapper=self._client_wrapper) self.notebook = AsyncNotebookClient(client_wrapper=self._client_wrapper) diff --git a/src/scrapybara/core/client_wrapper.py b/src/scrapybara/core/client_wrapper.py index f59b9a3..fe993b6 100644 --- a/src/scrapybara/core/client_wrapper.py +++ b/src/scrapybara/core/client_wrapper.py @@ -16,7 +16,7 @@ def get_headers(self) -> typing.Dict[str, str]: headers: typing.Dict[str, str] = { "X-Fern-Language": "Python", "X-Fern-SDK-Name": "scrapybara", - "X-Fern-SDK-Version": "2.0.7", + "X-Fern-SDK-Version": "2.1.0", } headers["x-api-key"] = self.api_key return headers diff --git a/src/scrapybara/types/__init__.py b/src/scrapybara/types/__init__.py index b83f133..40bc910 100644 --- a/src/scrapybara/types/__init__.py +++ b/src/scrapybara/types/__init__.py @@ -1,6 +1,5 @@ # This file was auto-generated by Fern from our API Definition. -from .act_response import ActResponse from .auth_state_response import AuthStateResponse from .browser_authenticate_response import BrowserAuthenticateResponse from .browser_get_cdp_url_response import BrowserGetCdpUrlResponse @@ -19,7 +18,6 @@ from .notebook import Notebook from .notebook_cell import NotebookCell from .save_browser_auth_response import SaveBrowserAuthResponse -from .scrape_response import ScrapeResponse from .start_browser_response import StartBrowserResponse from .status import Status from .stop_browser_response import StopBrowserResponse @@ -28,7 +26,6 @@ from .validation_error_loc_item import ValidationErrorLocItem __all__ = [ - "ActResponse", "AuthStateResponse", "BrowserAuthenticateResponse", "BrowserGetCdpUrlResponse", @@ -47,7 +44,6 @@ "Notebook", "NotebookCell", "SaveBrowserAuthResponse", - "ScrapeResponse", "StartBrowserResponse", "Status", "StopBrowserResponse", diff --git a/src/scrapybara/types/act_response.py b/src/scrapybara/types/act_response.py deleted file mode 100644 index f808f43..0000000 --- a/src/scrapybara/types/act_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.pydantic_utilities import UniversalBaseModel -import typing -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -import pydantic - - -class ActResponse(UniversalBaseModel): - output: str - screenshot: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow diff --git a/src/scrapybara/types/scrape_response.py b/src/scrapybara/types/scrape_response.py deleted file mode 100644 index 1b4799d..0000000 --- a/src/scrapybara/types/scrape_response.py +++ /dev/null @@ -1,20 +0,0 @@ -# This file was auto-generated by Fern from our API Definition. - -from ..core.pydantic_utilities import UniversalBaseModel -import typing -from ..core.pydantic_utilities import IS_PYDANTIC_V2 -import pydantic - - -class ScrapeResponse(UniversalBaseModel): - data: typing.Dict[str, typing.Optional[typing.Any]] - screenshot: typing.Optional[str] = None - - if IS_PYDANTIC_V2: - model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2 - else: - - class Config: - frozen = True - smart_union = True - extra = pydantic.Extra.allow