Skip to content

Commit

Permalink
Make deliver return a dict instead of response
Browse files Browse the repository at this point in the history
  • Loading branch information
kuba2k2 authored Feb 27, 2021
1 parent 6180418 commit 43ecdca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions gpapi/googleplay.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def reviews(self, packageName, filterByDevice=False, sort=2,
output.append(utils.parseProtobufObj(review))
return output

def _deliver_data(self, url, cookies):
def deliver_data(self, url, cookies):
headers = self.getHeaders()
response = requests.get(url, headers=headers,
cookies=cookies, verify=ssl_verify,
Expand Down Expand Up @@ -559,16 +559,17 @@ def delivery(self, packageName, versionCode=None, offerType=1,
result['additionalData'] = []
result['splits'] = []
downloadUrl = response.payload.deliveryResponse.appDeliveryData.downloadUrl
downloadSize = response.payload.deliveryResponse.appDeliveryData.downloadSize
cookie = response.payload.deliveryResponse.appDeliveryData.downloadAuthCookie[0]
cookies = {
str(cookie.name): str(cookie.value)
}
result['file'] = self._deliver_data(downloadUrl, cookies)
result['file'] = {"url": downloadUrl, "cookies": cookies, "size": downloadSize}

for split in response.payload.deliveryResponse.appDeliveryData.split:
a = {}
a['name'] = split.name
a['file'] = self._deliver_data(split.downloadUrl, None)
a['file'] = {"url": split.downloadUrl, "cookies": None, "size": split.size}
result['splits'].append(a)

if not expansion_files:
Expand All @@ -583,7 +584,7 @@ def delivery(self, packageName, versionCode=None, offerType=1,
obbType = 'patch'
a['type'] = obbType
a['versionCode'] = obb.versionCode
a['file'] = self._deliver_data(obb.downloadUrl, None)
a['file'] = {"url": obb.downloadUrl, "cookies": None, "size": obb.size}
result['additionalData'].append(a)
return result

Expand Down

0 comments on commit 43ecdca

Please sign in to comment.