mirror of
https://github.com/FliegendeWurst/googleplay-api.git
synced 2024-11-22 12:54:58 +00:00
Improved python2 compatibility
Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
This commit is contained in:
parent
65e33a5c74
commit
0a5e270049
@ -1,4 +1,6 @@
|
|||||||
language: python
|
language: python
|
||||||
python: '3.6'
|
python:
|
||||||
|
- "2.7"
|
||||||
|
- "3.5"
|
||||||
install: pip install .
|
install: pip install .
|
||||||
script: python test.py
|
script: python test.py
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# Google play python3 API [![Build Status](https://travis-ci.org/NoMore201/googleplay-api.svg?branch=master)](https://travis-ci.org/NoMore201/googleplay-api)
|
# Google play python API [![Build Status](https://travis-ci.org/NoMore201/googleplay-api.svg?branch=master)](https://travis-ci.org/NoMore201/googleplay-api)
|
||||||
|
|
||||||
This project contains an unofficial API for google play interactions. The code mainly comes from
|
This project contains an unofficial API for google play interactions. The code mainly comes from
|
||||||
[GooglePlayAPI project](https://github.com/egirault/googleplay-api/) which was written for python2 and it's not
|
[GooglePlayAPI project](https://github.com/egirault/googleplay-api/) which is not
|
||||||
maintained anymore. The code was ported to python3 with some important changes:
|
maintained anymore. The code was updated with some important changes:
|
||||||
|
|
||||||
* ac2dm authentication with checkin and device info upload
|
* ac2dm authentication with checkin and device info upload
|
||||||
* updated search and download calls
|
* updated search and download calls
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
from . import googleplay_pb2
|
from . import googleplay_pb2
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
import configparser
|
import sys
|
||||||
|
|
||||||
|
VERSION = sys.version_info[0]
|
||||||
|
if VERSION == 2:
|
||||||
|
import ConfigParser
|
||||||
|
else:
|
||||||
|
import configparser
|
||||||
|
|
||||||
# separator used by search.py, categories.py, ...
|
# separator used by search.py, categories.py, ...
|
||||||
SEPARATOR = ";"
|
SEPARATOR = ";"
|
||||||
@ -13,7 +19,11 @@ GOOGLE_PUBKEY = "AAAAgMom/1a/v0lblO2Ubrt60J2gcuXSljGFQXgcyZWveWLEwo6prwgi3iJIZ
|
|||||||
# if you want to add another phone, just create another section in
|
# if you want to add another phone, just create another section in
|
||||||
# the file. Some configurations for common phones can be found here:
|
# the file. Some configurations for common phones can be found here:
|
||||||
# https://github.com/yeriomin/play-store-api/tree/master/src/main/resources
|
# https://github.com/yeriomin/play-store-api/tree/master/src/main/resources
|
||||||
config = configparser.ConfigParser()
|
if VERSION == 2:
|
||||||
|
config = ConfigParser.ConfigParser()
|
||||||
|
else:
|
||||||
|
config = configparser.ConfigParser()
|
||||||
|
|
||||||
filepath = os.path.join( os.path.dirname( os.path.realpath(__file__) ), 'device.properties')
|
filepath = os.path.join( os.path.dirname( os.path.realpath(__file__) ), 'device.properties')
|
||||||
config.read(filepath)
|
config.read(filepath)
|
||||||
device = {}
|
device = {}
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
import struct
|
import struct
|
||||||
|
import sys
|
||||||
|
|
||||||
|
VERSION = sys.version_info[0]
|
||||||
|
|
||||||
def fromDocToDictionary(app):
|
def fromDocToDictionary(app):
|
||||||
return {
|
return {
|
||||||
@ -65,6 +68,9 @@ def toBigInt(byteArray):
|
|||||||
array = byteArray[::-1] # reverse array
|
array = byteArray[::-1] # reverse array
|
||||||
out = 0
|
out = 0
|
||||||
for key, value in enumerate(array):
|
for key, value in enumerate(array):
|
||||||
decoded = struct.unpack("B", bytes([value]))[0]
|
if VERSION == 3:
|
||||||
|
decoded = struct.unpack("B", bytes([value]))[0]
|
||||||
|
else:
|
||||||
|
decoded = struct.unpack("B", value)[0]
|
||||||
out = out | decoded << key*8
|
out = out | decoded << key*8
|
||||||
return out
|
return out
|
||||||
|
Loading…
Reference in New Issue
Block a user