omkarcloud / botasaurus

The All in One Framework to build Awesome Scrapers.
https://www.omkar.cloud/botasaurus/
MIT License
1.16k stars 104 forks source link

Don't understand how to use any of the ProfileManager functions #25

Closed gameuser1982 closed 6 months ago

gameuser1982 commented 6 months ago

Description

The scraping stuff is all clear to me as I have experience with Selerium (And the Beautiful Soup stuff wasn't too bad either), but I am not getting how to properly use anything here: https://github.com/omkarcloud/botasaurus?tab=readme-ov-file#i-have-automated-the-creation-of-user-accounts-now-i-want-to-store-the-user-account-credentials-like-email-and-password-how-to-store-it

Steps to Reproduce

Here's the script its only purpose is to grasp how to use these functions

from botasaurus import *

user = bt.generate_user(country=bt.Country.IN)
print(user)
bt.Profile.set_profile(user)
bt.Profile.set_item("api_key", "BDEC26")
profiles = bt.Profile.get_all_profiles()
print(profiles)

Expected behavior: Save user data in a Chrome profile?

Actual behavior: [What actually happens]

Traceback (most recent call last): File "C:\py311botasaurus\btprofiles.py", line 5, in bt.Profile.set_profile(user) File "C:\py311botasaurus\py311botasaurus\Lib\site-packages\botasaurus\profile.py", line 146, in set_profile self.check_profile() File "C:\py311botasaurus\py311botasaurus\Lib\site-packages\botasaurus\profile.py", line 83, in check_profile raise Exception('This method can only be run in run method of Task and when you have given the current profile in the Browser Config.') Exception: This method can only be run in run method of Task and when you have given the current profile in the Browser Config.

Reproduces how often: [What percentage of the time does it reproduce?]

Every time. I have no idea how to use anything here: https://github.com/omkarcloud/botasaurus?tab=readme-ov-file#i-have-automated-the-creation-of-user-accounts-now-i-want-to-store-the-user-account-credentials-like-email-and-password-how-to-store-it

Additional context

Chetan11-dev commented 6 months ago

Yeah Docs need Improvement, For now read https://www.omkar.cloud/botasaurus/docs/sign-up-tutorial/ to understand the logic.

gameuser1982 commented 6 months ago

Thanks! This should and actually your docs are overall excellent especially when compared to the Selerium docs!

Chetan11-dev commented 6 months ago

Thanks