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

NoPlayerPositionSetException when using PGoApi.set_proxy #3986

Closed
tgyhlsb opened this issue Aug 15, 2016 · 2 comments
Closed

NoPlayerPositionSetException when using PGoApi.set_proxy #3986

tgyhlsb opened this issue Aug 15, 2016 · 2 comments

Comments

@tgyhlsb
Copy link

tgyhlsb commented Aug 15, 2016

Expected Behavior

No crash.

Actual Behavior

When I try to use a proxy with set_proxy from PGoApi I get an NoPlayerPositionSetException.

  File ".../metrics.py", line 84, in capture_stats
    response_dict = request.call()
  File ".../api_wrapper.py", line 93, in call
    if not self.can_call():
  File ".../api_wrapper.py", line 57, in can_call
    raise NoPlayerPositionSetException()

I use a free proxy I found with google:

                self.api.set_proxy({
                    'http': 'socks5://5.154.6.107:43803',
                    'https': 'socks5://5.154.6.107:43803',
                })

In the ApiWrapper.can_call(), self._position_lat, self._position_lng and self._position_alt are all set to None.

Your config.json (remove your credentials and any other private info)

{
    "auth_service": "google",
    "username": "********",
    "password": "********",
    "location": "43.604914458104375,1.4475131034851074",
    "gmapkey": "**************************",
    "encrypt_location": "",
    "tasks": [
      {
        "type": "HandleSoftBan"
      },
      {
        "type": "SleepSchedule",
        "config": {
          "enabled": true,
          "time": "23:54",
          "duration":"9:46",
          "time_random_offset": "00:24",
          "duration_random_offset": "00:43"
        }
      },
      {
        "type": "CollectLevelUpReward"
      },
      {
        "type": "IncubateEggs",
        "config": {
          "longer_eggs_first": false
        }
      },
      {
        "type": "UpdateLiveStats",
        "config": {
          "enabled": true,
          "min_interval": 120,
          "stats": ["username", "level", "uptime", "stardust_earned", "xp_earned", "xp_per_hour", "stops_visited", "pokemon_caught", "captures_per_hour"],
          "terminal_log": true,
          "terminal_title": true
        }
      },
      {
        "type": "TransferPokemon"
      },
      {
        "type": "NicknamePokemon",
        "config": {
          "enabled": true,
          "nickname_template": "{name} {iv_pct}_{iv_ads}"
        }
      },
      {
        "type": "EvolvePokemon",
        "config": {
            "evolve_all": "none"
        }
      },
      {
        "type": "RecycleItems",
        "config": {
          "min_empty_space": 15,
          "item_filter": {
            "Pokeball":       { "keep" : 50 },
            "Greatball":      { "keep" : 50 },
            "Potion":         { "keep" : 0 },
            "Super Potion":   { "keep" : 20 },
            "Hyper Potion":   { "keep" : 30 },
            "Revive":         { "keep" : 30 },
            "Razz Berry":     { "keep" : 100 }
          }
        }
      },
      {
        "type": "CatchVisiblePokemon"
      },
      {
        "type": "CatchLuredPokemon"
      },
      {
        "type": "SpinFort"
      },
      {
        "type": "MoveToFort",
        "config": {
            "lure_attraction": true,
            "lure_max_distance": 2000
        }
      },
      {
        "type": "FollowSpiral",
        "config": {
          "diameter": 4,
          "step_size": 70
        }
      }
    ],
    "map_object_cache_time": 5,
    "forts": {
      "avoid_circles": true,
      "max_circle_size": 50,
      "cache_recent_forts": true
    },
    "websocket_server": false,
    "walk": 7.66,
    "action_wait_min": 1,
    "action_wait_max": 3,
    "debug": false,
    "test": false,
    "health_record": true,
    "location_cache": true,
    "distance_unit": "km",
    "reconnecting_timeout": 15,
    "catch_randomize_reticle_factor": 1.0,
    "catch_randomize_spin_factor": 1.0,
    "min_ultraball_to_keep": 10,
    "logging_color": true,
    "catch": {
      "any": {"catch_above_cp": 0, "catch_above_iv": 0, "logic": "or"},
      "// Example of always catching Rattata:": {},
      "// Rattata": { "always_catch" : true }
    },
    "catch_throw_parameters": {
      "excellent_rate": 0.2,
      "great_rate": 0.4,
      "nice_rate": 0.3,
      "normal_rate": 0.1,
      "spin_success_rate" : 0.5
    },
    "release": {
      "any": {"release_below_cp": 1000, "release_below_iv": 0.8, "logic": "or"},
      "// Example of always releasing Rattata:": {},
      "// Rattata": {"always_release": true},
      "// Example of keeping 3 stronger (based on CP) Pidgey:": {},
      "// Pidgey": {"keep_best_cp": 3},
      "// Example of keeping 2 stronger (based on IV) Zubat:": {},
      "// Zubat": {"keep_best_iv": 2},
      "// Also, it is working with any": {},
      "// any": {"keep_best_iv": 3},
      "// Example of keeping the 2 strongest (based on CP) and 3 best (based on IV) Zubat:": {},
      "// Zubat": {"keep_best_cp": 2, "keep_best_iv": 3}
    },
    "vips" : {
         "Any pokemon put here directly force to use Berry & Best Ball to capture, to secure the capture rate!": {},
        "any": {"catch_above_cp": 1200, "catch_above_iv": 0.9, "logic": "or" },
        "Lapras": {},
        "Moltres": {},
        "Zapdos": {},
        "Articuno": {},

        "// S-Tier pokemons (if pokemon can be evolved into tier, list the representative)": {},
        "Mewtwo": {},
        "Dragonite": {},
        "Snorlax": {},
        "// Mew evolves to Mewtwo": {},
        "Mew": {},
        "Arcanine": {},
        "Vaporeon": {},
        "Gyarados": {},
        "Exeggutor": {},
        "Muk": {},
        "Weezing": {},
        "Flareon": {}

    }
}

Steps to Reproduce

Replace each self.api = ApiWrapper() in pokemongo-bot/__init__.py by:

            self.api = ApiWrapper()
            self.api.set_proxy({
                'http': 'socks5://5.154.6.107:43803',
                'https': 'socks5://5.154.6.107:43803',
            })

Other Information

OS: Mac OSX 10.11.6
Python Version: Python 2.7.6

@k4n30
Copy link
Contributor

k4n30 commented Aug 15, 2016

What exactly is the issue?
You've made changes to the code so are you asking for help with the changes you're trying to make, or are you making an issue because the code doesn't support the changes you're trying to make?

@tgyhlsb
Copy link
Author

tgyhlsb commented Aug 15, 2016

Sorry, I was asking help about the changes I'm trying to make. I am trying to use PGoApi.set_proxy with this bot.

I fixed my issue by calling set_proxy after self._set_starting_position(). Which resolved the NoPlayerPositionSetException.

Now I have :

Traceback (most recent call last):
  File "pokecli.py", line 578, in <module>
    main()
  File "pokecli.py", line 145, in main
    report_summary(bot)
  File "pokecli.py", line 180, in report_summary
    metrics.capture_stats()
  File ".../pokemongo_bot/metrics.py", line 84, in capture_stats
    response_dict = request.call()
  File ".../pokemongo_bot/api_wrapper.py", line 93, in call
    if not self.can_call():
  File ".../pokemongo_bot/api_wrapper.py", line 61, in can_call
    raise NotLoggedInException()
pgoapi.exceptions.NotLoggedInException
2016-08-15 12:29:27,531 [sentry.errors] [ERROR] Sentry responded with an error: 'module' object has no attribute 'HTTPSHandler' (url: https://app.getsentry.com/api/90254/store/)
Traceback (most recent call last):
  File ".../lib/python2.7/site-packages/raven/transport/threaded.py", line 174, in send_sync
    super(ThreadedHTTPTransport, self).send(data, headers)
  File ".../lib/python2.7/site-packages/raven/transport/http.py", line 47, in send
    ca_certs=self.ca_certs,
  File ".../lib/python2.7/site-packages/raven/utils/http.py", line 44, in urlopen
    class ValidHTTPSHandler(urllib2.HTTPSHandler):
AttributeError: 'module' object has no attribute 'HTTPSHandler'

Which may be about the encrypt.so, hope I am making progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants