Skip to content
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

Lvl 1 Accounts not working due to mobile searches #217

Open
2 tasks done
Guido30 opened this issue Oct 25, 2024 · 6 comments
Open
2 tasks done

Lvl 1 Accounts not working due to mobile searches #217

Guido30 opened this issue Oct 25, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@Guido30
Copy link

Guido30 commented Oct 25, 2024

Before submitting a bug report...

  • This bug wasn't already reported.
    (I have checked every bug report on GitHub)

  • I've cleared the sessions folder.

Branch

develop

Commit

49e4930

Describe the bug

Lvl 1 Bing Rewards account dont work with the script since they re not allowed to farm points using the mobile searches yet, only the pc search searches are found

Copy and paste your error

2024-10-25 17:56:03,644 [INFO] [BING] Starting Desktop Edge Bing searches...
2024-10-25 17:56:08,000 [ERROR]
Traceback (most recent call last):
File "C:\Repositories\MS-Rewards-Farmer\main.py", line 40, in main
earned_points = executeBot(currentAccount, args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repositories\MS-Rewards-Farmer\main.py", line 246, in executeBot
searches.bingSearches()
File "C:\Repositories\MS-Rewards-Farmer\src\searches.py", line 110, in bingSearches
desktopAndMobileRemaining = self.browser.getRemainingSearches(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repositories\MS-Rewards-Farmer\src\browser.py", line 268, in getRemainingSearches
mobileSearch: dict = counters["MobileSearch"][0]
~~~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'MobileSearch'

Screenshots

image

Value of dashboard variable

.

@Guido30 Guido30 added the bug Something isn't working label Oct 25, 2024
@klept0
Copy link
Owner

klept0 commented Oct 27, 2024

Try dev build and run the desktop only flag

@Ices-Eyes
Copy link

I've solved this problem by a simple mod on the browser.py in function getRemainingSearches:

try:
    mobileSearch: dict = counters["mobileSearch"][0]
except:
    mobileSearch = None
pointProgressMax: int = pcSearch["pointProgressMax"]

[...]

if mobileSearch is None:
    mobilePointsRemaining = 0
else:
    mobilePointsRemaining = (
        mobileSearch["pointProgressMax"] - mobileSearch["pointProgress"]
    )

@cal4
Copy link
Collaborator

cal4 commented Nov 15, 2024

Good try, but it's better to raise an exception if these fields aren't as we expect, rather than hide it since it'll definitely cause problems with execution later. Checkout this for more general reasoning: https://stackoverflow.com/a/77361/4164390.

I've made a change to develop so that getRemainingSearches should be more reliable (without returning None/0)

@Ices-Eyes
Copy link

The fact is that on account of level 1, the mobileSearch aren't counted for rewards, hence the dashboard has't that section... so here we cannot expect that the mobileSearch section is present, in my opinion.
Maybe instead of catching the exception we could use the userStatus.levelInfo.activeLevel info...

@cal4
Copy link
Collaborator

cal4 commented Nov 15, 2024

Ah right, I see now. Hmm

@cal4
Copy link
Collaborator

cal4 commented Nov 17, 2024

Should be fixed, give develop a try. See 81afb32.

Thanks for the contribution @Ices-Eyes. Modified it a bit to check for level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants