Пример #1
0
def list_live_posts():

    tracking_post_ids = weibo_module.get_tracking_postids()

    print "########## POSTS TRACKING ##########"
    print "# of posts we're tracking: ", len(tracking_post_ids)

    if (len(tracking_post_ids) > 0):

        for this_post_id in tracking_post_ids:
            print "Checking post #" + this_post_id + ":",

            this_post_new = weibo_module.get_most_recent_live_post(
                this_post_id)
            this_post_old = weibo_module.get_oldest_post(this_post_id)

            print "alive: new/old repost count (", this_post_new[
                "post_repost_count"], " / ", this_post_old[
                    "post_repost_count"], ") "

            #			print "* this_post_new = " , this_post_new

            elapsedtime = nowdatetime - weibo_module.set_timezone_to_china(
                this_post_new["started_tracking_at"])
            print "elapsed time = ", elapsedtime
Пример #2
0
def list_live_posts():

	tracking_post_ids = weibo_module.get_tracking_postids()

	print "########## POSTS TRACKING ##########"
	print "# of posts we're tracking: " , len(tracking_post_ids)

	if (len(tracking_post_ids) > 0):

		for this_post_id in tracking_post_ids:
			print "Checking post #" + this_post_id + ":",

			this_post_new = weibo_module.get_most_recent_live_post(this_post_id)
			this_post_old = weibo_module.get_oldest_post(this_post_id)

			print "alive: new/old repost count (" , this_post_new["post_repost_count"] , " / " , this_post_old["post_repost_count"] , ") "

#			print "* this_post_new = " , this_post_new

			elapsedtime  = nowdatetime - weibo_module.set_timezone_to_china(this_post_new["started_tracking_at"]) 
			print "elapsed time = " ,  elapsedtime
Пример #3
0
def list_retired_posts():

	retired_post_ids = weibo_module.get_retired_postids()

	print ""
	print "########## RETIRED POSTS ##########"
	num_retired_posts = len(retired_post_ids)
	print "# of retired posts we've tracked: " + str(num_retired_posts)
	if (num_retired_posts > 0):
		retired_post_ids = []

		for this_post_id in retired_post_ids:
			print "Checking post # " + this_post_id , 

			# get the post info from postids_live collection,
			# since if the post was retired we wouldn't have any of that info anymore

			this_post_new = weibo_module.get_most_recent_live_post(this_post_id)
			this_post_old = weibo_module.get_oldest_post(this_post_id)



			print "alive: new/old repost count (" , this_post_new["post_repost_count"] , " / " , this_post_old["post_repost_count"] , ") "
Пример #4
0
def list_retired_posts():

    retired_post_ids = weibo_module.get_retired_postids()

    print ""
    print "########## RETIRED POSTS ##########"
    num_retired_posts = len(retired_post_ids)
    print "# of retired posts we've tracked: " + str(num_retired_posts)
    if (num_retired_posts > 0):
        retired_post_ids = []

        for this_post_id in retired_post_ids:
            print "Checking post # " + this_post_id,

            # get the post info from postids_live collection,
            # since if the post was retired we wouldn't have any of that info anymore

            this_post_new = weibo_module.get_most_recent_live_post(
                this_post_id)
            this_post_old = weibo_module.get_oldest_post(this_post_id)

            print "alive: new/old repost count (", this_post_new[
                "post_repost_count"], " / ", this_post_old[
                    "post_repost_count"], ") "
Пример #5
0
# pseudocode
# does it exist? NO --- it was deleted! turn the flag on, log in checklog
# does it exist? YES! -- too old? NO:  log in checklog
# does it exist? YES! -- too old? YES: turn flag on,  log in checklog

checkpostcount = 0

for this_post_id in tracking_post_ids:
    checkpostcount += 1

    print "=========================="
    print "CHECK", checkpostcount, ":: checking post # " + this_post_id
    thispost_is_alive = True

    this_post_newest = weibo_module.get_most_recent_live_post(this_post_id)
    this_post_oldest = weibo_module.get_oldest_post(this_post_id)
    thispost_created_at = weibo_module.set_timezone_to_china(
        this_post_newest['post_created_at'])
    elapsedtime = nowdatetime - thispost_created_at

    #	print "now is = " , nowdatetime
    #	print "newest sez created at = " , this_post_newest["post_created_at"]
    #	print "oldt commitest sez created at = " , this_post_oldest["post_created_at"]
    print "* time elapsed = ", elapsedtime, " and in seconds", weibo_module.total_seconds(
        elapsedtime)

    # so - we look for the post
    # if we have an error, assemble a skeletal post consisting of post id, is_deleted, error message, error code, checekd_at, and then put it in checklog.
    # whic means that we should check first for the existenc of an error
    # refreshpost will give us back the error, otherwise returns a dict
Пример #6
0
# pseudocode
# does it exist? NO --- it was deleted! turn the flag on, log in checklog
# does it exist? YES! -- too old? NO:  log in checklog
# does it exist? YES! -- too old? YES: turn flag on,  log in checklog

checkpostcount = 0

for this_post_id in tracking_post_ids:
    checkpostcount += 1

    print "=========================="
    print "CHECK", checkpostcount, ":: checking post # " + this_post_id
    thispost_is_alive = True

    this_post_newest = weibo_module.get_most_recent_live_post(this_post_id)
    this_post_oldest = weibo_module.get_oldest_post(this_post_id)
    thispost_created_at = weibo_module.set_timezone_to_china(this_post_newest["post_created_at"])
    elapsedtime = nowdatetime - thispost_created_at

    # 	print "now is = " , nowdatetime
    # 	print "newest sez created at = " , this_post_newest["post_created_at"]
    # 	print "oldt commitest sez created at = " , this_post_oldest["post_created_at"]
    print "* time elapsed = ", elapsedtime, " and in seconds", weibo_module.total_seconds(elapsedtime)

    # so - we look for the post
    # if we have an error, assemble a skeletal post consisting of post id, is_deleted, error message, error code, checekd_at, and then put it in checklog.
    # whic means that we should check first for the existenc of an error
    # refreshpost will give us back the error, otherwise returns a dict

    try:
        refreshedpost = weibo_module.refreshpost(this_post_id)