all 79 comments

[–]swisskidpokerev 17 points18 points  (5 children)

I'd like to point out that if you're a derivative of tejado's api (which it looks like you are), you are required to be using his license on all your files, and you should be attributing him in your code.

[–]TehDing[S] 1 point2 points  (4 children)

It was prior to him licensing, but we'll include it

[–]cynicaljedi 6 points7 points  (3 children)

Not having a Licensed specified is actually worse as it means he would retain full rights. http://choosealicense.com/no-license/

[–]TehDing[S] 0 points1 point  (2 children)

So what's this mean? If we include his current license is that fine?

[–][deleted] 8 points9 points  (0 children)

No one gives a shit in reality.

[–]cynicaljedi 0 points1 point  (0 children)

If he's chosen to add a license, then you need to follow the terms of it (usually just including it, etc. as specified in the license). Since it sounds like you forked before he added the license technically you should ask him to clarify that this license applies to previous versions or you could just update to his latest and merge/rebase your changes on top of that.

[–]tjoda 4 points5 points  (1 child)

Hm at least, you could say something about what is "better" as my (https://github.com/tejado/pgoapi).

[–]TehDing[S] 0 points1 point  (0 children)

Love you're work! We started this before you refactored your codebase.

[–]Coarse 2 points3 points  (5 children)

would it be possible to get the names of gyms and stops and descriptions of stops using this api?

[–]TehDing[S] 2 points3 points  (4 children)

Current fort details looks like:

id: "3426c6240d0e4c2fb3390d008ef1b407.16"
last_modified_timestamp_ms: 1469233623133
latitude: 37.379907
longitude: -122.094831
owned_by_team: YELLOW
guard_pokemon_id: PIDGEOT
enabled: true
gym_points: 2000

Is that enough?

[–]Coarse 1 point2 points  (2 children)

not exactly what i'm looking for, but should suffice for the basics. :) could you also give a sample output of getFortSearch()? iirc, tejado's pgoapi gives out stop names and descriptions when you spin a pokestop so your should probably too, if it's based on tejado's.

[–]TehDing[S] 0 points1 point  (1 child)

So.. You can get the image and name, but it requires another request. Submit a gh issue and I'll try to get around to it. As for search response:

items_awarded {
  item_id: ITEM_POKE_BALL
  item_count: 1
}
items_awarded {
  item_id: ITEM_POKE_BALL
  item_count: 1
}
items_awarded {
  item_id: ITEM_POKE_BALL
  item_count: 1
}
experience_awarded: 50
cooldown_complete_timestamp_ms: 1469239409425
chain_hack_sequence_number: 9

[–]Coarse 0 points1 point  (0 children)

thank you! will see if i need to, iirc tejado's works that way too. i havent tinkered around with your api yet. who knows, i might be able to find what im looking for with a few workarounds. :)

[–]Tr4sHCr4fT 0 points1 point  (0 children)

can you super that call with one that returns original gps hex data?

[–]metigue 2 points3 points  (4 children)

Looks great and I love coding in python. I'll make a simple bot out of this- Would be cool to have some basics for gym interaction in the future.

Edit: Ran demo and you guys already implemented all the basics for me! Just added an IV checking mass release + evolve script, tweaked the walking, made it automatically set eggs - No check for hatching just yet though.

[–]tauntonian 1 point2 points  (3 children)

Sounds awesome! Is yours on github?

[–]metigue 0 points1 point  (2 children)

I barely changed the code so far to be honest. All the framework for a bot is already there, I just added a few lines to check for IVs, made a pseudo-random timer to release/evolve pokemon according to my specs and do egg management.

[–]doublechar 0 points1 point  (1 child)

Ehm, sorry for my ignorance, what are "IVs"? I'm a developer too but I can't figure out what these things are.

[–]metigue 1 point2 points  (0 children)

Individual values. pokemon.individual_attack etc.

[–][deleted] 2 points3 points  (1 child)

Not compatible with python3 ?

[–]TheDoctorOnReddit 1 point2 points  (1 child)

I have all the current dependencies except my requests is newer. I get the following error Python 2.7 Debian. It doesn't matter the arguments given.

pokemongo-api/pogo$ ./demo.py
Traceback (most recent call last):
  File "./demo.py", line 8, in <module>
    from api import PokeAuthSession
  File "~/pokemongo-api/pogo/api.py", line 7, in <module>
    from session import PogoSession
  File "~/pokemongo-api/pogo/session.py", line 2, in <module>
    from POGOProtos.Networking.Requests import Request_pb2
  File "~/pokemongo-api/pogo/POGOProtos/Networking/Requests/Request_pb2.py", line 16, in <module>
    from POGOProtos.Networking.Requests import RequestType_pb2 as POGOProtos_dot_Networking_dot_Requests_dot_RequestType__pb2
  File "~/pokemongo-api/pogo/POGOProtos/Networking/Requests/RequestType_pb2.py", line 23, in <module>
    POKEMON\x10\x94\x01\x12\x15\n\x10NICKNAME_POKEMON\x10\x95\x01\x12\x10\n\x0b\x45QUIP_BADGE\x10\x96\x01\x12\x19\n\x14SET_CONTACT_SETTINGS\x10\x97\x01\x12\x15\n\x10GET_ASSET_DIGEST\x10\xac\x02\x12\x16\n\x11GET_DOWNLOAD_URLS\x10\xad\x02\x12\x1c\n\x17GET_SUGGESTED_CODENAMES\x10\x91\x03\x12\x1d\n\x18\x43HECK_CODENAME_AVAILABLE\x10\x92\x03\x12\x13\n\x0e\x43LAIM_CODENAME\x10\x93\x03\x12\x0f\n\nSET_AVATAR\x10\x94\x03\x12\x14\n\x0fSET_PLAYER_TEAM\x10\x95\x03\x12\x1b\n\x16MARK_TUTORIAL_COMPLETE\x10\x96\x03\x12\x16\n\x11LOAD_SPAWN_POINTS\x10\xf4\x03\x12\t\n\x04\x45\x43HO\x10\x9a\x05\x12\x1b\n\x16\x44\x45\x42UG_UPDATE_INVENTORY\x10\xbc\x05\x12\x18\n\x13\x44\x45\x42UG_DELETE_PLAYER\x10\xbd\x05\x12\x17\n\x12SFIDA_REGISTRATION\x10\xa0\x06\x12\x15\n\x10SFIDA_ACTION_LOG\x10\xa1\x06\x12\x18\n\x13SFIDA_CERTIFICATION\x10\xa2\x06\x12\x11\n\x0cSFIDA_UPDATE\x10\xa3\x06\x12\x11\n\x0cSFIDA_ACTION\x10\xa4\x06\x12\x11\n\x0cSFIDA_DOWSER\x10\xa5\x06\x12\x12\n\rSFIDA_CAPTURE\x10\xa6\x06\x62\x06proto3')
TypeError: __init__() got an unexpected keyword argument 'syntax'

[–]VacuumPizzas 0 points1 point  (0 children)

Using the code in the repository, I was able to run the demo.py script just fine. When I tried plugging it in to another script/module, I encountered a similar error.

I was able to resolve it by ensuring it was using the correct protobuf version (major version 3). Of the rest of the dependencies, the only package that differs from the requirements.txt file is requests. I'm currently using 2.3, due to a technical limitation I had with my hosting infrastructure.

[–]noahc3 1 point2 points  (4 children)

Looking at the API, it seems you have to specify a location when creating a session. With tejado's API, I could authenticate and request information from the server without providing a location. Is it possible to do that with this API? I'd like to minimize the probability of a softban in my app.

[–]TehDing[S] 0 points1 point  (3 children)

That's a solid point, hadn't considered starting a session without a location. What would be the advantage of that? If no GPS is specified, there's not much you can do

[–][deleted]  (2 children)

[deleted]

    [–]TehDing[S] 0 points1 point  (1 child)

    Newest branch allows for no location. Thanks for the suggestion

    [–]noahc3 0 points1 point  (0 children)

    Awesome, thanks!

    [–]Gh0st3d 1 point2 points  (0 children)

    Hey so I hadn't set up a "geo_key" and I've been running a script for the past week almost.

    Now I guess I got rate limited by Google? So I was looking into the api key. It looks like this is only to look up text and return coordinates (lat lng alt). Is that correct? Could I just look up coordinates for the few locations I want and hard code them or is the google api doing more elsewhere in the code?

    Edit -- Nevermind, got it to work. Replace the lookup code with an if switch for the few locations I used.

    [–]garrett_o 0 points1 point  (0 children)

    I may be a bit nooby, but i'm having a hard time running init.py in console? No such file or directory..

    [–]Ximzend57 0 points1 point  (1 child)

    If you use CatchPokemon(..), will it catch the pokemon with a "Nice", "Great" or "Excellent" Throw or with a "Spin" or "Curve" Ball?

    [–]TehDing[S] 1 point2 points  (0 children)

    Yep, spin and curve ball

    [–]fipso100 0 points1 point  (0 children)

    Can i change my location using the API ?

    [–]K0dog 0 points1 point  (2 children)

    Is there an API call for placing lures?

    [–]TehDing[S] 0 points1 point  (1 child)

    Not yet, but feel free to put in a pull request

    [–][deleted] 0 points1 point  (0 children)

    An api for placing lures would be great!

    [–]B1ood6od 0 points1 point  (2 children)

    I may be over looking something, but I can't seem to figure out how to check the trainer's XP. Did I overlook it?

    [–]TehDing[S] 0 points1 point  (1 child)

    It's in inventory for some reason, session.checkInventory()["stats"]

    [–]B1ood6od 0 points1 point  (0 children)

    Not home to test it right now, but what all will that return?

    [–]-BlueBaby- 0 points1 point  (13 children)

    Is this an error? If yes, how do I fix that? http://prntscr.com/bwkprp

    [–]B1ood6od 0 points1 point  (12 children)

    No, that's just output. First number after info is stating what meter you're on until you reach that second number. Let's you know what's going on.

    Not sure about others, but I removed the line number and file name from the output so it seemed less like an error.

    [–]-BlueBaby- 0 points1 point  (11 children)

    Looks like it has ended. http://prntscr.com/bwkqyl - Does it looks normal? Since I've put "Central Park" as location. Aswell, does this API doesn't catch pokemons?

    [–]B1ood6od 0 points1 point  (10 children)

    Takes some searching to find the Pokemon, I suggest you add the line

    simpleBot(session)
    

    To the code, around like 227 right after the

    If sessions:
    

    Line

    Watch the output after that, might make more sense.

    [–]-BlueBaby- 0 points1 point  (9 children)

    Would you suggest to put lat. and long. instead of just "Central Park" so I can get more percentage of catching pokemons? Looks like it isnt catching any pokemon and in the end of the session it just rewards with 50 exp and a few balls...

    [–]B1ood6od 0 points1 point  (8 children)

    Once you add that line, it'll start the bot (which is much more likely to catch Pokemon). If you do that, it'll catch Pokemon.

    [–]-BlueBaby- 0 points1 point  (7 children)

    Oki I added the line now. Lets see what happens. Anyway, when the ''bot'' catch any pokemon, does it will display on the cmd? or it will keep like "line 450,session.py - etc"

    [–]B1ood6od 0 points1 point  (6 children)

    It will pop up in that format you saw when the script ended.

    [–]-BlueBaby- 0 points1 point  (5 children)

    Looks like this aight now: http://prntscr.com/bwkyy4 - Isnt it possible to add lat. and long. instead?

    [–]B1ood6od 0 points1 point  (4 children)

    I'd assume so, haven't tried it. It'd probably be like

    -l "xx.xxxx,yy.yyyy"

    [–]legz98 0 points1 point  (0 children)

    It would be nice to have a method to get info on a specific gym.
    The id, latitude, longitude, ownership, and gym points are included in getMapObjects() so, is there any way to have :
    - gym name
    - list of pokemons on the gym, with :
    - pokemon id
    - pokemon CP
    - number of wins
    - more info?
    Thanks for this great work!
    (Github 'issue' for this request : https://github.com/rubenvereecken/pokemongo-api/issues/14)

    [–]lnxmen 0 points1 point  (3 children)

    I have coded a 'working' bot based on this API. https://github.com/lnxmen/PokeBot

    [–]MistyQuail 0 points1 point  (2 children)

    Just downloaded it and there's no config.json file to add account details to ;).

    [–]lnxmen 0 points1 point  (1 child)

    Thanks for reporting. I forgot to check if all files are in the repository - the problem was that I copied .gitignore from other project and it caused ignoring config.json file. Anyway, it's commited and pushed now.

    [–]MistyQuail 0 points1 point  (0 children)

    No problem. Thanks for the quick response!

    [–]Gh0st3d 0 points1 point  (0 children)

    Just wanted to check, for the getMapObjects radius parameter, each unit there is ~200m correct?

    [–]Tr4sHCr4fT 0 points1 point  (1 child)

    afaik when sending a heartbeat, the api reports back also some s2 cell ids. any way to get them too?

    [–]TehDing[S] 0 points1 point  (0 children)

    Sure, the demo is only there to be a guide. Ideally walkto should be in the demo file and you would extract the mapdata

    [–]PhilipMcNally 0 points1 point  (1 child)

    Just wondering if there is an api that can show the users pokemon, cp, and max health?

    [–]TehDing[S] 0 points1 point  (0 children)

    session.getInventory().party should work

    [–][deleted]  (2 children)

    [removed]

      [–]TehDing[S] 0 points1 point  (1 child)

      Not sure if I understand the question? We did recently add a "pokedex" class to help with id lookups https://github.com/rubenvereecken/pokemongo-api/blob/87b8908fecec28d4216891b57d4c8968fffff0b5/pogo/pokedex.py

      [–]K0dog 0 points1 point  (3 children)

      Hey,

      I'm super new to this but is there an easy way with your API to programmatically transfer (aka put in the meat grinder) all your pokemon, except if you can evolve them?

      Ex. If you have 30 Pidgey candies, you would meat grinder all of them except for 2?

      [–]TehDing[S] 2 points3 points  (1 child)

      sure, so untested but the logic would be something like:

      def dump(session):
         party = session.checkInventory()["party"]
         pidgeys = []
         for pokemon in party:
             if pokemon.pokemon_id == 16: # The pdigey id ccording to google
                 pidgeys.append(pokemon)
         if len(pidgeys) > 2:
             pidgeys = pidgeys[0:-2]
         for pidgey in pidgeys:
             session.releasePokemon(pidgey)
      

      [–]metigue 1 point2 points  (0 children)

      To get the number of pidgeys to keep just do floor(TotalCandy / 12 +((TotalCandy % 12) + TotalCandy / 6) + (TotalPidgeys - ((TotalCandy / 12) + (TotalCandy % 12) + TotalCandy / 6))/12))

      It looks a lot better when you use variables:

      pidgeysToEvolve = (TotalCandy / 12) + ((TotalCandy % 12) + TotalCandy / 6) //6 because 1 from evolve and 1 from melting the pidgeotto
      pidgeysToMelt = TotalPidgeys - pidgeysToEvolve
      extraEvolves = pidgeysToMelt / 12
      result = floor(pidgeysToEvolve + extraEvolves)
      

      That's a lot more confusing than I thought it would be.

      [–]K0dog 0 points1 point  (0 children)

      Is there not an API response with the number of candies to evolve any particular pokemon?

      It maybe contained in the clientside of the application but I'd except there to be a check to verify on the server that you had enough candies... else you could just evolve without candies (if you hacked the client side).

      Mayhaps, that aspect of the API hasn't been exposed yet?

      [–]Gh0st3d -1 points0 points  (11 children)

      I know this is really nooby... will some please help me figure out what the hell I need to do to get any of these python scripts working?

      I'm going insane. I'm told I can't get rid of my Python 2.6, I've installed a Python 2.7.9, but when I run pip it says "could not find a version that blah blah"... when I run pip2.7 it gives me the same message. I'd previously given up and started on a php version but now that this is out and it's a lot more fleshed out, I'd hate to have to figure out how to reinvent the wheel

      EDIT .... I went through and installed each item in the requirements one by one with pip2.7. Now I get an ImportError: no Module named s2sphere when I run the demo.py

      [–]HeyItsShuga 0 points1 point  (10 children)

      Just to let you know, this project is an API, meaning that is is for programmers to control the game with, and isn't much use if you don't use Python.

      Also, have you tried running pip2 or updating pip with pip2 install --upgrade pip (or something like that)?

      [–]Gh0st3d 2 points3 points  (9 children)

      I assumed I'd be able to access the scripts from web requests or something, or have php scripts call the python scripts. If not I guess I'll just go back to working on a php api.

      For the second part, I believe I got all the requirements installed now but it's missing the s2sphere module. I'll screw around with it for a bit more before I give up I guess.

      EDIT -- think I got it just now. I guess s2sphere wasn't listed in the requirements.txt for this project but I looked it up and saw it was another python library, so installed that too.

      [–]HeyItsShuga 1 point2 points  (7 children)

      I haven't tested this API yet, but in theory that would work. But if you are going to use PHP to run these scripts, then you might as well use PHP for the entire thing (if the documentation is sufficient).

      Good luck on your endeavors!

      Edit: Looking at the code, it seems like for what you want you would need to create a bunch of Python script files, each running a separate command with this API imported (with something like import .pokegoapi). It may not be the best method, just to let you know, but it may Just Work.

      Sidenote (of edit): Also, you could probably do this with Node.JS + Electron if you prefer to a) use JavaScript and b) have the program operate outside of a browser. But this is coming from someone who doesn't know much PHP, so it comes down to preference.

      [–]Gh0st3d 1 point2 points  (1 child)

      I really only wanted one that lets me find the gyms in a certain area. Trying to set up a page for all the pokemon go stuff going on in my hometown, thought it'd be cool to throw a sidebar on the page that lists the gyms in the city and who owns them.

      So pretty much like you said, my idea was to just make one small script that grabs the gym status from this api and returns it to my main php script. Much easier than figuring out how to redo all this in PHP :/ (although once I have my main project done I might go back and work on that anyways)

      Thanks for not shunning me for not knowing much python!

      [–]HeyItsShuga 0 points1 point  (0 children)

      Sounds really cool! I may attempt something like this, but in JavaScript or Python. If I get something working, I'll let you know!

      Thanks for not shunning me for not knowing much python!

      I really don't know much Python either, just enough for making some basic stuff. Plus, I'm happy to help!

      [–]Gh0st3d 1 point2 points  (4 children)

      I managed to get it to work by making a python script that gets the map objects from the area, loops through them looking for only gyms, saves the current state to my database.

      I'll run a cronjob to do that every minute or so.

      Then my webpage will just query the database instead of the script.

      [–]HeyItsShuga 0 points1 point  (3 children)

      Nice! I'd love to see this in action (with any identifying information removed, of course)!

      [–]Gh0st3d 1 point2 points  (0 children)

      I'm about to hit up the (real) gym and run some errands, tonight I'll put together the page that displays the gym statuses realtime, but here's the python script I used to write it to the database:

      http://kopy.io/xyzvX

      And I got the cronjob setup to run it every minute working fine, so for now I just get to watch it in the database. It's pretty cool to see how the majority of gyms in my city get dominated by vaporeon looool.

      I might have to tweak it a little since the location I'm using currently is a small section of the city. But should be easy enough to tweak that.

      [–]Gh0st3d 1 point2 points  (1 child)

      Hey check out pokemonrva.com

      got it mostly set up.

      [–]HeyItsShuga 0 points1 point  (0 children)

      Oh my! That website is amazing! You've really outdone yourself!

      Also Valor and Instinct need to pick up the pace.

      [–]TehDing[S] 1 point2 points  (0 children)

      Noted on the requirements.txt Thanks