上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 67 下一页
摘要: ``` # 多进程,使用Process对象 from multiprocessing import Process def f(name): print('hello', name) if __name__ == '__main__': p_1 = Process(target=f, args=('bob',)) p_1.start() p_1.join() ... 阅读全文
posted @ 2019-05-06 15:59 hank-li 阅读(87) 评论(0) 推荐(0)
摘要: ``` # 多进程,使用Pool from multiprocessing import Pool def f(x): return x*x if __name__ == '__main__': p = Pool(5) list = [1,2,3,4,5,6,7,8,9] print(p.map(f, list)) ``` ``` # 多进程,使用Pool i... 阅读全文
posted @ 2019-05-06 15:54 hank-li 阅读(112) 评论(0) 推荐(0)
摘要: ``` # 模拟登录微博 import time import base64 import rsa import binascii import requests import re import random try: from PIL import Image except BaseException: pass try: from urllib.parse impo... 阅读全文
posted @ 2019-05-06 06:29 hank-li 阅读(208) 评论(0) 推荐(0)
摘要: ``` # 模拟登录豆瓣 from urllib.request import urlretrieve import requests from bs4 import BeautifulSoup from os import remove try: import cookielib except BaseException: import http.cookiejar as co... 阅读全文
posted @ 2019-05-05 21:04 hank-li 阅读(122) 评论(0) 推荐(0)
摘要: ``` # 使用自造的cookies登录GitHub import requests from lxml import etree str = '_octo=GH1.1.518803230.1537264616; logged_in=no; _ga=GA1.2.102113046.1537264618; _gh_sess=RTIralVlQ1pHaG0vVG44b3NsV0s4Z2VZTTVi... 阅读全文
posted @ 2019-05-04 22:07 hank-li 阅读(235) 评论(0) 推荐(0)
摘要: ``` # 使用自造的cookies登录马蜂窝 import requests from lxml import etree str = 'mfw_uuid=5bcfcc20-b235-fbbe-c1d6-ae01e1f68d82; _r=baidu; _rp=a%3A2%3A%7Bs%3A1%3A%22p%22%3Bs%3A19%3A%22www.baidu.com%2Fbaidu%22%3B... 阅读全文
posted @ 2019-05-04 21:32 hank-li 阅读(137) 评论(0) 推荐(0)
摘要: ``` # 利用cookies登录马蜂窝 import requests from lxml import etree session = requests.Session() phone_number = '13521093039' password = 'pro123,./' data = {'passport': phone_number, 'password': password} h... 阅读全文
posted @ 2019-05-04 21:19 hank-li 阅读(129) 评论(0) 推荐(0)
摘要: ``` # 模拟登录GitHub import requests from lxml import etree class Login(): def __init__(self): self.headers = { 'Referer': 'https://github.com/', 'User-Agent': 'Mozill... 阅读全文
posted @ 2019-05-04 18:12 hank-li 阅读(123) 评论(0) 推荐(0)
摘要: ``` # 模拟登录马蜂窝 import requests from lxml import etree session = requests.Session() phone_number = input('电话') password = input('密码') data = {'passport': phone_number, 'password': password} header = { ... 阅读全文
posted @ 2019-05-04 18:11 hank-li 阅读(151) 评论(0) 推荐(0)
摘要: 什么是模拟登录? 要抓取的信息,只有在登录之后才能查看。这种情况下,就需要爬虫做模拟登录,绕过登录页。 cookies和session的区别: cookie数据存放在客户的浏览器上,session数据放在服务器上; cookie不是很安全,别人可以分析存放在本地的COOKIE并进行COOKIE欺骗, 阅读全文
posted @ 2019-05-04 18:05 hank-li 阅读(206) 评论(0) 推荐(0)
上一页 1 ··· 22 23 24 25 26 27 28 29 30 ··· 67 下一页