|
@@ -2,7 +2,6 @@
|
|
|
@author: luojunhui
|
|
|
每日将odps的回流前5000的数据存储迁移的数据库中
|
|
|
"""
|
|
|
-import time
|
|
|
import asyncio
|
|
|
|
|
|
import aiohttp
|
|
@@ -23,7 +22,7 @@ async def asyncPost(url, headers, payload):
|
|
|
async with aiohttp.ClientSession() as session:
|
|
|
for attempt in range(3):
|
|
|
try:
|
|
|
- async with session.post(url, headers=headers, data=payload, timeout=10) as response:
|
|
|
+ async with session.post(url, headers=headers, json=payload, timeout=10) as response:
|
|
|
return await response.json()
|
|
|
except asyncio.TimeoutError:
|
|
|
if attempt < retries - 1:
|
|
@@ -55,7 +54,7 @@ class updateFromOdps(object):
|
|
|
"""
|
|
|
date_info = getYesterdayStr()
|
|
|
sql = f"""
|
|
|
- select videoid, title, return_lastday, uid, lastday_return, share_total, 品类标签, dt
|
|
|
+ select videoid, title, 回流人数, uid, 总曝光, share_total, 品类标签, dt
|
|
|
from loghubods.lastday_return
|
|
|
where dt = '{date_info}';
|
|
|
"""
|
|
@@ -64,9 +63,9 @@ class updateFromOdps(object):
|
|
|
{
|
|
|
"video_id": i['videoid'],
|
|
|
"title": i['title'],
|
|
|
- "last_day_return": i['return_lastday'],
|
|
|
+ "last_day_return": i['回流人数'],
|
|
|
"uid": i['uid'],
|
|
|
- "last_day_view": i['lastday_return'],
|
|
|
+ "last_day_view": i['总曝光'],
|
|
|
"last_day_share": i['share_total'],
|
|
|
"category": i['品类标签'],
|
|
|
"dt": i['dt']
|
|
@@ -112,5 +111,5 @@ class updateFromOdps(object):
|
|
|
headers=headers,
|
|
|
payload=video_obj
|
|
|
)
|
|
|
- return response.json
|
|
|
+ return response
|
|
|
|