Skip to content

Commit

Permalink
Start to use the signature interface. (#4245)
Browse files Browse the repository at this point in the history
* Start to use the signature interface.

* Added dummy class to show how to use:
DeviceInfo
ActivityStatus
SensorInfo

* sensor data is randomly generated (#4249)

* including activity status details resulted in uk6 fail (no map objects), need more iOS dumps to identify the issue

* Switch the upstream of pgoapi to joelgreen, he will handle the upupstream PR as well.
  • Loading branch information
solderzzc authored Aug 19, 2016
1 parent 399e4c9 commit 576a0c6
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
49 changes: 48 additions & 1 deletion pokemongo_bot/api_wrapper.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import time
import logging
import random

from pgoapi.exceptions import (ServerSideRequestThrottlingException,
NotLoggedInException, ServerBusyOrOfflineException,
NoPlayerPositionSetException, EmptySubrequestChainException,
UnexpectedResponseException)
from pgoapi.pgoapi import PGoApi, PGoApiRequest, RpcApi
from pgoapi.protos.POGOProtos.Networking.Requests.RequestType_pb2 import RequestType
from pgoapi.protos.POGOProtos.Networking.Envelopes.Signature_pb2 import Signature
from pgoapi.utilities import get_time

from human_behaviour import sleep

Expand Down Expand Up @@ -63,7 +66,51 @@ def can_call(self):
return True

def _call(self):
return PGoApiRequest.call(self)
# Need fill in the location_fix
location_fix = Signature.LocationFix()

sensor_info = Signature.SensorInfo(
timestamp_snapshot=(get_time(ms=True) - RpcApi.START_TIME) - random.randint(200, 400),
magnetometer_x=random.uniform(-0.139084026217, 0.138112977147),
magnetometer_y=random.uniform(-0.2, 0.19),
magnetometer_z=random.uniform(-0.2, 0.4),
angle_normalized_x=random.uniform(-47.149471283, 61.8397789001),
angle_normalized_y=random.uniform(-47.149471283, 61.8397789001),
angle_normalized_z=random.uniform(-47.149471283, 5),
accel_raw_x=random.uniform(0.0729667818829, 0.0729667818829),
accel_raw_y=random.uniform(-2.788630499244109, 3.0586791383810468),
accel_raw_z=random.uniform(-0.34825887123552773, 0.19347580173737935),
gyroscope_raw_x=random.uniform(-0.9703824520111084, 0.8556089401245117),
gyroscope_raw_y=random.uniform(-1.7470258474349976, 1.4218578338623047),
gyroscope_raw_z=random.uniform(-0.9681901931762695, 0.8396636843681335),
accel_normalized_x=random.uniform(-0.31110161542892456, 0.1681540310382843),
accel_normalized_y=random.uniform(-0.6574847102165222, -0.07290205359458923),
accel_normalized_z=random.uniform(-0.9943905472755432, -0.7463029026985168),
accelerometer_axes=3
)
device_info = Signature.DeviceInfo(
device_id='HASHVALUE',

This comment has been minimized.

Copy link
@surewhynotmon

surewhynotmon Aug 19, 2016

device-id need to be a uuid?

device_brand='Apple',
device_model='iPhone',
device_model_boot='iPhone8,2',
hardware_manufacturer='Apple',
hardware_model='N66AP',
firmware_brand='iPhone OS',
firmware_type='9.3.3'
)
activity_status = Signature.ActivityStatus(
# walking=True,
# stationary=True,
# automotive=True,
# tilting=True
)
signature = Signature(
#location_fix=location_fix,
sensor_info=sensor_info,
device_info=device_info,
activity_status=activity_status
)
return PGoApiRequest.call(self, signature)

def _pop_request_callers(self):
r = self.request_callers
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
numpy==1.11.0
networkx==1.11
-e git+https://github.com/keyphact/pgoapi.git@12b2028cbf19342efd971020033027802b569769#egg=pgoapi
-e git+https://github.com/joelgreen/pgoapi.git@1ee949e4299ddc8a5d8b9b41443640c2bf2fa5ca#egg=pgoapi

This comment has been minimized.

Copy link
@surewhynotmon

surewhynotmon Aug 19, 2016

Is this better than pogodevorg/pgoapi#108?

geopy==1.11.0
protobuf==3.0.0b4
requests==2.10.0
Expand Down

2 comments on commit 576a0c6

@NatNew0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new pgoapi breaks the logon procedure at least for google-auth:
2016-08-19 19:59:47,581 [PokemonGoBot] [INFO] [login_started] Login procedure started.
2016-08-19 19:59:48,323 [pgoapi.pgoapi] [ERROR] Login process failed: User login failed!
2016-08-19 19:59:48,324 [PokemonGoBot] [INFO] [login_failed] Login error, server busy. Waiting 10 seconds to try again.
( with the old api logon is possible)

@balpoint
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having the same issue as @NatNew0

2016-08-19 20:05:59,888 [pgoapi.pgoapi] [ERROR] Login process failed: User login failed!
2016-08-19 20:05:59,888 [PokemonGoBot] [INFO] [login_failed] Login error, server busy. Waiting 10 seconds to try again.
2016-08-19 20:06:10,604 [pgoapi.pgoapi] [ERROR] Login process failed: User login failed!
2016-08-19 20:06:10,604 [PokemonGoBot] [INFO] [login_failed] Login error, server busy. Waiting 10 seconds to try again.

Please sign in to comment.