예제 #1
0
    nb_results = 20

api = GooglePlayAPI(ANDROID_ID)
api.login(GOOGLE_LOGIN, GOOGLE_PASSWORD, AUTH_TOKEN)

n = 0
while (n < nb_results):
    if n == 0:
        n += 20
        message = api.list(cat, ctr, '20', offset)
        if message == False:
            print "Error: HTTP 500 - one of the provided parameters is invalid"
            exit(1)
    else:
        time.sleep(2)
        message = api.getNextPage(nextPageUrl)
        if message == False:
                print 'error or no more app'
                break
    doc = message.doc[0]
    nextPageUrl = doc.containerMetadata.nextPageUrl

    if (ctr is None):
        print SEPARATOR.join(["Subcategory ID", "Name"])
        for doc in message.doc:
            print SEPARATOR.join([doc.docid.encode('utf8'), doc.title.encode('utf8')])
    else:
        print_header_line()
        doc = message.doc[0]
        for c in doc.child:
            print_result_line(c)