两种方式:
一、
接口,可以pip install requests模块,安装一个requests,对接口支持简单好用
例子,写一个getcookie()方法
import requests
def getcookie():
data={'username':username,'password':pwd}
session=requestssession()
loginurl=">
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<meta name="keywords" content="白菜编辑部">
<title>白菜编辑部</title>
<style type="text/css">
</style>
<script type="text/javascript">
function readCookie (name)
{
var cookieValue = "";
var search = name + "=";
if (documentcookielength > 0)
{
offset = documentcookieindexOf (search);
if (offset != -1)
{
offset += searchlength;
end = documentcookieindexOf (";", offset);
if (end == -1)
end = documentcookielength;
cookieValue = unescape (documentcookiesubstring (offset, end))
}
}
return cookieValue;
}
function writeCookie (name, value, hours)
{
var expire = "";
if (hours != null)
{
expire = new Date ((new Date ())getTime () + hours 3600000);
expire = "; expires=" + expiretoGMTString ();
}
documentcookie = name + "=" + escape (value) + expire;
}
writeCookie ("myCookie", "my name", 24);
alert (readCookie ("myCookie"));
</script>
</head>
<body>
</body>
</html>
int id = 1;
>
WebMagic框架可以通过>
以上就是关于关于用python写的登陆程序,怎么获取cookie值并返回出来全部的内容,包括:关于用python写的登陆程序,怎么获取cookie值并返回出来、js中如何获取cookies中的键值的值、如何使用js来获取cookie的值等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)