Skip to content

🕷️ The BEST Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scrapling_dev

fix(shell): Hide the automatic tips and solve the namespace issue

Karim shoair3e63fa25238b
diff --git a/scrapling/core/shell.py b/scrapling/core/shell.py
index 30f8a4c..a70458b 100644
--- a/scrapling/core/shell.py
+++ b/scrapling/core/shell.py
@@ -525,16 +525,17 @@ Type 'exit' or press Ctrl+D to exit.
def start(self):
"""Start the interactive shell"""
- # Create the shell
- ipython_shell = InteractiveShellEmbed(banner1=self.banner(), exit_msg="Bye Bye")
-
- # Store reference to the shell
- self.shell = ipython_shell
-
# Get our namespace with application objects
namespace = self.get_namespace()
+ ipython_shell = InteractiveShellEmbed(
+ banner1=self.banner(),
+ banner2="",
+ enable_tip=False,
+ exit_msg="Bye Bye",
+ user_ns=namespace,
+ )
+ self.shell = ipython_shell
- ipython_shell.user_ns.update(namespace)
# If a command was provided, execute it and exit
if self.code:
log.info(f"Executing provided code: {self.code}")
@@ -544,4 +545,4 @@ Type 'exit' or press Ctrl+D to exit.
log.error(f"Error executing initial code: {e}")
return
- ipython_shell(local_ns=namespace)
+ ipython_shell()