python调用js脚本。首先安装PyExecJS

import execjs

def get_js():
    f = open("tongchengJS.js", 'r', encoding='utf-8')
    line = f.readline()
    htmlstr = ''
    while line:
        htmlstr = htmlstr+line
        line = f.readline()
    return htmlstr


def get_des_psswd(e):
    js_str = get_js()
    ctx = execjs.compile(js_str)
    return (ctx.call('antitoken', e))


print(get_des_psswd(e='1570243707293'))

  

posted on 2020-08-26 16:02  itprobie-菜鸟程序员  阅读(238)  评论(1编辑  收藏  举报