예제 #1
0
 def __init__(self):
     self.host = 'http://srm-in.t.xgimi.com/apis'
     self.token = gettoken_OA('xiaomei.zhang', 'Xx123456')
예제 #2
0
import requests
import sys
import threading
import time
from srm2.common.gettoken import gettoken_OA
from requests_toolbelt import MultipartEncoder

host = 'http://srm-in.t.xgimi.com/apis'
token = gettoken_OA('xiaomei.zhang', 'Xx123456')


def now():
    return str(time.strftime('%Y-%m-%d %H:%M:%S', time.localtime()))


def testForecast(forecastWeek=None, purchaserCode=None, supplierCode=None):
    print('start loop', 'at:', now())
    start = time.clock()

    url = host + '/forecast_item/list'
    datas = {
        'forecastWeek': forecastWeek,
        'purchaserCode': purchaserCode,
        'supplierCode': supplierCode
    }
    header = {'token': token}
    r = requests.get(url, params=datas, headers=header)
    message = r.json()

    end = time.clock()
    print("run: %f s" % (end - start))