Added setup.py + changes to the lib structure

Signed-off-by: Domenico Iezzi <domenico.iezzi.201@gmail.com>
This commit is contained in:
Domenico Iezzi 2017-09-21 11:19:48 +02:00
parent 88bf0589b4
commit 1739425d35
10 changed files with 40 additions and 10 deletions

View File

@ -1,4 +1,4 @@
language: python
python: '3.6'
install: pip install -r requirements.txt
install: pip install .
script: python test.py

View File

@ -2,11 +2,25 @@
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
maintained anymore. The code was ported to python3 with some minor additions and updates, mainly for python3 compatibility.
maintained anymore. The code was ported to python3 with some important changes:
All credit goes to the original author [egirault](https://github.com/egirault).
* ac2dm authentication with checkin and device info upload
* updated search and download calls
* using headers of a Nexus 6P. Add you own device under `device.properties` file
This project is released under the BSD license.
# Usage
Check the test.py module for a simple example.
An important note about login function:
```
def login(self, email, password, ac2dmToken=None, gsfId=None)
```
for first time logins, you should only provide email and password.
The module will take care of retrieving an ac2dm token, registering
"your device" to the google account you supplied, and retrieving
a Google Service Framework ID (which basically is the android ID of a device).
For the next logins you **should** save the ac2dm master token and the gsfId (androidId), and provide them as parameters to the login function. If you login again with email and password only, this is the equivalent of deleting the google account from you device and re-initalize it every time.
# API reversing

0
gpapi/__init__.py Normal file
View File

View File

@ -1,4 +1,4 @@
import googleplay_pb2
from . import googleplay_pb2
import time
import os
import configparser

View File

@ -11,13 +11,11 @@ from Crypto.Hash import SHA
from Crypto.Cipher import PKCS1_OAEP
import requests
import config
import base64
import struct
import itertools
import googleplay_pb2
import utils
from . import googleplay_pb2, config, utils
ssl_verify = True
@ -165,7 +163,7 @@ class GooglePlayAPI(object):
response = googleplay_pb2.ResponseWrapper.FromString(res.content)
def login(self, email=None, password=None, ac2dmToken=None, gsfId=None):
def login(self, email, password, ac2dmToken=None, gsfId=None):
"""Login to your Google Account.
For first time login you should provide:
* email

18
setup.py Normal file
View File

@ -0,0 +1,18 @@
from setuptools import setup
setup(
name='googleplay-api',
version='0.1.0',
description='Unofficial python3 api for google play',
url='https://github.com/NoMore201/googleplay-api',
author='NoMore201',
author_email='domenico.iezzi.201@gmail.com',
license='MIT',
packages=['gpapi'],
package_data={
'gpapi': ['device.properties'],
},
install_requires=['pycrypto',
'protobuf',
'requests'],
)

View File

@ -1,4 +1,4 @@
from googleplay import GooglePlayAPI
from gpapi.googleplay import GooglePlayAPI
import sys