Initial userProfile implementation

This commit is contained in:
Domenico Iezzi 2017-11-27 17:40:10 +01:00
parent e9e866da97
commit 1e567277f5
3 changed files with 411 additions and 76 deletions

View File

@ -926,6 +926,18 @@ message SearchResponse {
repeated RelatedSearch relatedSearch = 6;
optional string nextPageUrl = 10;
}
message UserProfileResponseWrapper {
optional UserProfilePayload payload = 1;
optional ServerCommands commands = 2;
repeated PreFetch preFetch = 3;
repeated Notification notification = 4;
}
message UserProfilePayload {
optional UserProfileResponse response = 5;
}
message UserProfileResponse {
repeated DocV2 doc = 1;
}
message SearchSuggestResponse {
repeated SearchSuggestEntry entry = 1;
}

View File

@ -328,6 +328,22 @@ class GooglePlayAPI(object):
return output
def userProfile(self):
path = 'api/userProfile'
headers = self.getDefaultHeaders()
url = self.FDFE + path
response = requests.get(url, headers=headers,
verify=ssl_verify,
timeout=60)
message = googleplay_pb2.UserProfileResponseWrapper.FromString(response.content)
if message.commands.displayErrorMessage != "":
raise RequestError(message.commands.displayErrorMessage)
result = utils.fromDocToDictionary(message.payload.response.doc[0])
return result
def details(self, packageName):
"""Get app details from a package name.

File diff suppressed because one or more lines are too long