Repository: RocketMap/RocketMap

Issue:
Not working with Google accounts? (not a support request)
## Expected Behavior

The map should run normally. (And it does with a PTC account)
## Current Behavior

I have a confirmed working(Logged in on a phone and it works) Google account.
When I run the map I get this error

2016-08-22 07:57:16,392 [ search-overseer][        search][    INFO] Search overseer starting
2016-08-22 07:57:16,394 [ search-overseer][        search][    INFO] Starting search worker threads
2016-08-22 07:57:16,394 [      db-cleaner][        models][    INFO] Regular database cleaning complete
2016-08-22 07:57:16,397 [ search-overseer][        search][    INFO] New location caught, moving search grid
2016-08-22 07:57:16,401 [ search-overseer][        search][    INFO] Scan Distance is 0.07 km
2016-08-22 07:57:16,418 [ search-worker-0][        search][    INFO] Search step 1 beginning (queue size is 2)
2016-08-22 07:57:16,420 [ search-worker-0][   auth_google][    INFO] Google User Login for: acadia1005@gmail.com
2016-08-22 07:57:16,421 [ search-worker-0][        search][   ERROR] Exception in search_worker: perform_master_login() got an unexpected keyword argument 'proxy'. Username: acadia1005@gmail.com
Traceback (most recent call last):
  File "C:\PokemonGo-Map\pogom\search.py", line 504, in search_worker_thread
    check_login(args, account, api, step_location)
  File "C:\PokemonGo-Map\pogom\search.py", line 654, in check_login
    api.set_authentication(provider=account['auth_service'], username=account['username'], password=account['password'])
  File "C:\Users\lib\site-packages\pgoapi\pgoapi.py", line 92, in set_authentication
    self._auth_provider.user_login(username, password)
  File "C:\Users\lib\site-packages\pgoapi\auth_google.py", line 58, in user_login
    user_login = perform_master_login(username, password, self.GOOGLE_LOGIN_ANDROID_ID, proxy=self._proxy)
TypeError: perform_master_login() got an unexpected keyword argument 'proxy'
## Possible Solution

<!--- Not obligatory, but suggest a fix/reason for the bug, -->

<!--- or ideas how to implement the addition or change -->
## Steps to Reproduce (for bugs)

1.Run from git bash or command line
2.python runserver.py -a google -u googleaccount@gmail.com -p password -l "43.054868 -78.899176" -st 10 -k GmapsKey
## Context

Everything is working with PTC but not Google.
I have been using this map for weeks and then I updated today and now this is happening.
## Your Environment
- Version used: latest dev as of right now.
- python 2.7
- Windows 10



Discussion:
I got exactly the same thing! Everything is working with a PTC.

It seems gpsoauth version 0.4.0 instead of 0.3.0 is needed now, so requirements.txt needs to be updated:

https://github.com/PokemonGoMap/PokemonGo-Map/compare/develop...Braini01:patch-1


Resolving patch:
diff --git a/pogom/search.py b/pogom/search.py
--- a/pogom/search.py
+++ b/pogom/search.py
@@ -106,8 +106,14 @@ def status_printer(threadStatus, search_items_queue, db_updates_queue, wh_queue)
             # Create a list to hold all the status lines, so they can be printed all at once to reduce flicker
             status_text = []
 
+            # Calculate total skipped items
+            skip_total = 0
+            for item in threadStatus:
+                if 'skip' in threadStatus[item]:
+                    skip_total += threadStatus[item]['skip']
+
             # Print the queue length
-            status_text.append('Queues: {} items, {} db updates, {} webhook'.format(search_items_queue.qsize(), db_updates_queue.qsize(), wh_queue.qsize()))
+            status_text.append('Queues: {} search items, {} db updates, {} webhook.  Total skipped items: {}'.format(search_items_queue.qsize(), db_updates_queue.qsize(), wh_queue.qsize(), skip_total))
 
             # Print status of overseer
             status_text.append('{} Overseer: {}'.format(threadStatus['Overseer']['method'], threadStatus['Overseer']['message']))
@@ -277,7 +283,15 @@ def search_overseer_thread(args, method, new_location_queue, pause_bit, encrypti
                 search_args = (step, step_location[0], step_location[1], step_location[2])
                 search_items_queue.put(search_args)
         else:
-            threadStatus['Overseer']['message'] = 'Processing search queue'
+            nextitem = search_items_queue.queue[0]
+            threadStatus['Overseer']['message'] = 'Processing search queue, next item is {:6f},{:6f}'.format(nextitem[1][0], nextitem[1][1])
+            # If times are specified, print the time of the next queue item, and how many seconds ahead/behind realtime
+            if nextitem[2]:
+                threadStatus['Overseer']['message'] += ' @ {}'.format(time.strftime('%H:%M:%S', time.localtime(nextitem[2])))
+                if nextitem[2] > now():
+                    threadStatus['Overseer']['message'] += ' ({}s ahead)'.format(nextitem[2] - now())
+                else:
+                    threadStatus['Overseer']['message'] += ' ({}s behind)'.format(now() - nextitem[2])
 
         # Now we just give a little pause here
         time.sleep(1)
@@ -428,9 +442,9 @@ def search_worker_thread(args, account, search_items_queue, pause_bit, encryptio
                 # If this account has been messing up too hard, let it rest
                 if status['fail'] >= args.max_failures:
                     end_sleep = now() + (3600 * 2)
-                    long_sleep_started = time.strftime('%H:%M')
+                    long_sleep_started = time.strftime('%H:%M:%S')
                     while now() < end_sleep:
-                        status['message'] = 'Account "{}" has failed more than {} scans; possibly banned account. Sleeping for 2 hour sleep as of {}'.format(account['username'], args.max_failures, long_sleep_started)
+                        status['message'] = 'Worker {} failed more than {} scans; possibly banned account. Sleeping for 2 hour sleep as of {}'.format(account['username'], args.max_failures, long_sleep_started)
                         log.error(status['message'])
                         time.sleep(300)
                     break  # exit this loop to have the API recreated
@@ -452,7 +466,7 @@ def search_worker_thread(args, account, search_items_queue, pause_bit, encryptio
                             paused = True
                             break  # why can't python just have `break 2`...
                         remain = appears - now() + 10
-                        status['message'] = '{}s early for location {},{}; waiting...'.format(remain, step_location[0], step_location[1])
+                        status['message'] = 'Early for {:6f},{:6f}; waiting {}s...'.format(step_location[0], step_location[1], remain)
                         if first_loop:
                             log.info(status['message'])
                             first_loop = False
@@ -462,16 +476,16 @@ def search_worker_thread(args, account, search_items_queue, pause_bit, encryptio
                         continue
 
                 # too late?
-                if leaves and now() > leaves:
+                if leaves and now() > (leaves - args.min_seconds_left):
                     search_items_queue.task_done()
                     status['skip'] += 1
                     # it is slightly silly to put this in status['message'] since it'll be overwritten very shortly after. Oh well.
-                    status['message'] = 'Too late for location {},{}; skipping'.format(step_location[0], step_location[1])
+                    status['message'] = 'Too late for location {:6f},{:6f}; skipping'.format(step_location[0], step_location[1])
                     log.info(status['message'])
                     # No sleep here; we've not done anything worth sleeping for. Plus we clearly need to catch up!
                     continue
 
-                status['message'] = 'Searching at {},{}'.format(step_location[0], step_location[1])
+                status['message'] = 'Searching at {:6f},{:6f}'.format(step_location[0], step_location[1])
                 log.info(status['message'])
 
                 # Let the api know where we intend to be for this loop
@@ -486,7 +500,7 @@ def search_worker_thread(args, account, search_items_queue, pause_bit, encryptio
                 # G'damnit, nothing back. Mark it up, sleep, carry on
                 if not response_dict:
                     status['fail'] += 1
-                    status['message'] = 'Invalid response at {},{}, abandoning location'.format(step_location[0], step_location[1])
+                    status['message'] = 'Invalid response at {:6f},{:6f}, abandoning location'.format(step_location[0], step_location[1])
                     log.error(status['message'])
                     time.sleep(args.scan_delay)
                     continue
@@ -496,14 +510,15 @@ def search_worker_thread(args, account, search_items_queue, pause_bit, encryptio
                     findCount = parse_map(args, response_dict, step_location, dbq, whq)
                     search_items_queue.task_done()
                     status[('success' if findCount > 0 else 'noitems')] += 1
-                    status['message'] = 'Search at {},{} completed with {} finds'.format(step_location[0], step_location[1], findCount)
+                    status['message'] = 'Search at {:6f},{:6f} completed with {} finds'.format(step_location[0], step_location[1], findCount)
                     log.debug(status['message'])
                 except KeyError:
                     status['fail'] += 1
-                    status['message'] = 'Map parse failed at {},{}, abandoning location'.format(step_location[0], step_location[1])
+                    status['message'] = 'Map parse failed at {:6f},{:6f}, abandoning location. {} may be banned.'.format(step_location[0], step_location[1], account['username'])
                     log.exception(status['message'])
 
                 # Always delay the desired amount after "scan" completion
+                status['message'] += ', sleeping {}s until {}'.format(args.scan_delay, time.strftime('%H:%M:%S', time.localtime(time.time() + args.scan_delay)))
                 time.sleep(args.scan_delay)
 
         # catch any process exceptions, log them, and continue the thread
diff --git a/pogom/utils.py b/pogom/utils.py
--- a/pogom/utils.py
+++ b/pogom/utils.py
@@ -73,6 +73,9 @@ def get_args():
     parser.add_argument('-mf', '--max-failures',
                         help='Maximum number of failures to parse locations before an account will go into a two hour sleep',
                         type=int, default=5)
+    parser.add_argument('-msl', '--min-seconds-left',
+                        help='Time that must be left on a spawn before considering it too late and skipping it. eg. 600 would skip anything with < 10 minutes remaining. Default 0.',
+                        type=int, default=0)
     parser.add_argument('-dc', '--display-in-console',
                         help='Display Found Pokemon in Console',
                         action='store_true', default=False)


Test patch: