Skip to content

fix web.scrape, filename change #16

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion supadata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from supadata.client import Supadata
from supadata.errors import SupadataError
from supadata.types import (
from supadata.custom_types import (
CrawlJob,
CrawlPage,
CrawlResponse,
Expand Down
12 changes: 12 additions & 0 deletions supadata/automate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from supadata.client import Supadata
supadata = Supadata(api_key="your_api_key_here")
Comment on lines +1 to +2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Avoid hardcoding the API key
Embedding a placeholder API key in source risks accidental commits of real credentials. Load api_key from an environment variable or configuration file instead:

- supadata = Supadata(api_key="your_api_key_here")
+ import os
+ api_key = os.getenv("SUPADATA_API_KEY")
+ if not api_key:
+     raise RuntimeError("Missing SUPADATA_API_KEY environment variable")
+ supadata = Supadata(api_key=api_key)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from supadata.client import Supadata
supadata = Supadata(api_key="your_api_key_here")
from supadata.client import Supadata
import os
api_key = os.getenv("SUPADATA_API_KEY")
if not api_key:
raise RuntimeError("Missing SUPADATA_API_KEY environment variable")
supadata = Supadata(api_key=api_key)
🤖 Prompt for AI Agents
In supadata/automate.py at lines 1 to 2, avoid hardcoding the API key directly
in the source code. Modify the code to load the API key from an environment
variable or a configuration file instead, for example by importing the os module
and using os.getenv to retrieve the API key securely at runtime.


web_content = supadata.web.scrape("https://openai.com/index/introducing-deep-research/")

with open("issue.txt", 'w+') as f:
f.write(f"PAGE TITLE : {web_content.name}\n")

f.write(f"PAGE CONTENT : {web_content.content}")

# print(f"Page title : {web_content.name}")
# print(f"page content : {web_content.content}")
File renamed without changes.
Loading