requests
在发送到国外服务器上,用的是post,传递的是data参数,实参是ujson.dumps(param),param是字典,国外发送到国内的put,用法一样
上传文件到七牛
a = qiniu.Auth(ak,sk)
token = QINIU_AUTH.upload_token(上传的空间, file_name)
ret, info = qiniu.put_file(token, file_name, file_path)
数据库update_time比较
now_time = datetime.datetime.now()
yes_time = now_time + datetime.timedelta(days=-1)
query_time = db.session.query(PluginDetail).filter(PluginDetail.update_time >= yes_time)
数据库增加数据
obj = PluginDetail(
crx_two=crx_two,
crx_three=crx_three,
version=version,
type=TYPE2,
update_time=now_time,
)
db.session.add(obj)
db.session.commit()
db.session.rollback()
数据库模糊查询
desc:降序
result = db.session.query(PluginDetail).filter(
or_(PluginDetail.name.like(’%{}%’.format(keyword)),
PluginDetail.desc.like(’%{}%’.format(keyword)))
)
ten = result.order_by(PluginDetail.users.desc()).limit(10)
celery
@celery.task()
def get_version_info(data):
pass
get_version_info.delay(data)
git
git fetch