tejado / pgoapi

Pokemon Go API lib
Other
1.4k stars 447 forks source link

TypeError: Odd-length string #187

Open scottie opened 7 years ago

scottie commented 7 years ago

output = binascii.a2b_hex(input) TypeError: Odd-length string

2016-08-07 05:15:37,739 [    pgoapi] [ INFO] pgoapi v1.1.7 - Copyright (c) 2016 tjado <https://github.com/tejado>
2016-08-07 05:15:38,059 [ utilities] [ INFO] Location for 'Nimbin' found: Nimbin NSW 2480, Australia
2016-08-07 05:15:38,059 [ utilities] [ INFO] Coordinates (lat/long/alt) for location: -28.595833 153.223056 0.0
2016-08-07 05:15:38,061 [  auth_ptc] [ INFO] PTC User Login for: kDPDjkFzVKGg
2016-08-07 05:15:39,967 [  auth_ptc] [ INFO] PTC User Login successful.
2016-08-07 05:15:39,967 [  auth_ptc] [ INFO] Request PTC Access Token...
2016-08-07 05:15:40,429 [  auth_ptc] [ INFO] PTC Access Token successfully retrieved.
2016-08-07 05:15:40,445 [    pgoapi] [ INFO] Creating a new direct request...
2016-08-07 05:15:40,445 [    pgoapi] [ INFO] Adding 'GET_MAP_OBJECTS' to RPC request including arguments
2016-08-07 05:15:40,447 [    pgoapi] [ INFO] Execution of RPC
2016-08-07 05:15:41,052 [    pgoapi] [ INFO] API Endpoint redirect... re-execution of call
Traceback (most recent call last):
  File "pokecli.py", line 133, in <module>
    main()
  File "pokecli.py", line 128, in main
    response_dict = api.get_map_objects(latitude =position[0], longitude = position[1], since_timestamp_ms = timestamps, cell_id = cell_ids
) 
  File "/root/pgoapi/pgoapi/pgoapi.py", line 121, in function
    return request.call()
  File "/root/pgoapi/pgoapi/pgoapi.py", line 219, in call
    response = request.request(self._api_endpoint, self._req_method_list, self.get_position())
  File "/root/pgoapi/pgoapi/rpc_api.py", line 125, in request
    request_proto = self._build_main_request(subrequests, player_position)
  File "/root/pgoapi/pgoapi/rpc_api.py", line 196, in _build_main_request
    sig.location_hash1 = generateLocation1(ticket_serialized, request.latitude, request.longitude, request.altitude)
  File "/root/pgoapi/pgoapi/utilities.py", line 165, in generateLocation1
    locationBytes = d2h(lat) + d2h(lng) + d2h(alt)
  File "/root/pgoapi/pgoapi/utilities.py", line 183, in d2h
    return hex(struct.unpack('<Q', struct.pack('<d', f))[0])[2:-1].decode("hex")
  File "/usr/lib/python2.7/encodings/hex_codec.py", line 42, in hex_decode
    output = binascii.a2b_hex(input)
TypeError: Odd-length string
ProLoDs commented 7 years ago

same here, what python version are you using? My guess would be the python version. working with 2.7.11 error with 2.7.9

mviniciusleal commented 7 years ago

same error on 2.7.12

ProLoDs commented 7 years ago

use python3, worked for me. (just a workaround)

elliottcarlson commented 7 years ago

This is fixed in the new repo which will be merged in here at some point.

See https://github.com/keyphact/pgoapi/pull/9/files for solution.