'Download an app and return its raw data (APK file).
packageName is the app unique ID (usually starting with \'com.\').
versionCode can be grabbed by using the details() method on the given
app.'

def download(self, packageName, versionCode, offerType=1):

    path = 'purchase'
    data = ('ot=%d&doc=%s&vc=%d' % (offerType, packageName, versionCode))
    message = self.executeRequestApi2(path, data)
    url = message.payload.buyResponse.purchaseStatusResponse.appDeliveryData.downloadUrl
    cookie = message.payload.buyResponse.purchaseStatusResponse.appDeliveryData.downloadAuthCookie[0]
    cookies = {str(cookie.name): str(cookie.value)}
    headers = {'User-Agent': 'AndroidDownloadManager/4.1.1    (Linux;    U;    Android    4.1.1;    Nexus    S    Build/JRO03E)', 'Accept-Encoding': ''}
    response = requests.get(url, headers=headers, cookies=cookies, verify=False)
    return response.content
