-
Notifications
You must be signed in to change notification settings - Fork 702
add python docs #787
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
add python docs #787
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
Comprehensive addition of Python SDK documentation across Stagehand's documentation, including quickstart guides, examples, and integration patterns.
- Added new
docs/examples/python.mdx
with complete Python SDK usage, Pydantic integration, and data science workflows - Updated
docs/get_started/quickstart.mdx
with Python installation and basic setup instructions - Enhanced
docs/get_started/introduction.mdx
with parallel Python code examples alongside TypeScript - Added Python section to
docs/integrations/guides.mdx
with CrewAI integration details - Updated navigation structure in
docs.json
to include Python documentation under Playbooks
5 files reviewed, 5 comments
Edit PR Review Bot Settings | Greptile
import asyncio | ||
import os | ||
from stagehand import Stagehand, StagehandConfig | ||
from dotenv import load_dotenv |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: python-dotenv is not listed in prerequisites or installation steps but is used in the example
from dotenv import load_dotenv | |
```bash | |
pip install stagehand python-dotenv |
if __name__ == "__main__": | ||
main() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: main() is called without asyncio.run(), unlike other examples
if __name__ == "__main__": | |
main() | |
if __name__ == "__main__": | |
asyncio.run(main()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you run agent async ?
|
||
```python | ||
import asyncio | ||
from stagehand import Stagehand, StagehandConfig | ||
|
||
async def robust_automation(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: missing os import in error handling example but os.getenv is used
```python | |
import asyncio | |
from stagehand import Stagehand, StagehandConfig | |
async def robust_automation(): | |
```python | |
import asyncio | |
import os | |
from stagehand import Stagehand, StagehandConfig | |
async def robust_automation(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ya needs this
await stagehand.close() | ||
|
||
# Usage | ||
df = await scrape_to_dataframe() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logic: calling scrape_to_dataframe() directly without asyncio.run()
df = await scrape_to_dataframe() | |
# Usage | |
# df = await scrape_to_dataframe() # This should be called within an async function | |
# Or use: df = asyncio.run(scrape_to_dataframe()) |
page = stagehand.page | ||
await page.goto("https://github.com/browserbase/stagehand") | ||
|
||
await page.get_by_role("link", name=r"Contributors \d+").click() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
syntax: page.get_by_role expects parameter 'name' but the regex pattern uses raw string prefix r. Remove the r prefix
why
its about time!
what changed
added python docs to mintlify
test plan
n/a