Пример #1
0
def upload_msg(uid, username, puid, chatroom, msg_type, content, url):
    (db, cursor) = connectdb()
    cursor.execute(
        "insert into message(uid, username, puid, chatroom, msg_type, content, url, timestamp) values(%s, %s, %s, %s, %s, %s, %s, %s)",
        [
            uid, username, puid, chatroom, msg_type, content, url,
            int(time.time())
        ])
    closedb(db, cursor)
import json
import datetime
import os
from datetime import timedelta

from run import app, time2str, str2time, get_previous_month, get_next_month, connectdb, closedb

OpenID = sys.argv[1]
APPID = sys.argv[2]
AccessToken = sys.argv[3]
StartTime = int(sys.argv[4])
Username = sys.argv[5]
FILE_PREFIX = sys.argv[6]

try:
    (db, cursor) = connectdb()
    app.logger.error(str(OpenID) + ' history_basic start')

    access_url = "http://gw.open.ppdai.com/invest/BidService/BidList"
    current = int(time.time()) + 3600 * 24

    listings = []
    total = 0
    while current > StartTime:
        PageIndex = 1
        while True:
            if current - 3600 * 24 * 30 > StartTime:
                data = {
                    "StartTime":
                    time.strftime(
                        '%Y-%m-%d',