上一页 1 2 3 4 5 6 7 8 ··· 17 下一页

2021年3月9日

scrapy框架持久化存储 以及响应参数

摘要: 来看一下response对象中的一些基本方法/属性: 属性描述 url 获取本次request请求的url地址 status 获取本次request请求的状态码 body 获取HTML响应正文,返回的是bytes格式内容,因此如果请求的是图片,可直接拿到它进行写入 text 获取HTML响应正文,返 阅读全文

posted @ 2021-03-09 15:01 Plyc 阅读(73) 评论(0) 推荐(0) 编辑

scrapy框架

摘要: 安装 Linux: pip3 install scrapy Windows: a. pip3 install wheel b. 下载twisted http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted 下载并安装twisted的wheel文件,CP对应 阅读全文

posted @ 2021-03-09 14:46 Plyc 阅读(63) 评论(0) 推荐(0) 编辑

2021年3月8日

12306 模拟登陆

摘要: 超级鹰: #!/usr/bin/env python # coding:utf-8 import requests from hashlib import md5 class Chaojiying_Client(object): def __init__(self, username, passwo 阅读全文

posted @ 2021-03-08 23:06 Plyc 阅读(104) 评论(0) 推荐(0) 编辑

selenium

摘要: https://blog.csdn.net/weixin_44110998/article/details/103185785 # selenium 学习 window.navigator.webdriver # 规避检测 窗口切换 driver.get("https://seleniumhq.gi 阅读全文

posted @ 2021-03-08 22:16 Plyc 阅读(69) 评论(0) 推荐(0) 编辑

验证码处理

摘要: 云打码平台处理验证码的实现流程: 云打码平台处理验证码的实现流程: - 1.对携带验证码的页面数据进行抓取 - 2.可以将页面数据中验证码进行解析,验证码图片下载到本地 - 3.可以将验证码图片提交给三方平台进行识别,返回验证码图片上的数据值 - 云打码平台: - 1.在官网中进行注册(普通用户和开 阅读全文

posted @ 2021-03-08 16:52 Plyc 阅读(65) 评论(0) 推荐(0) 编辑

爬虫

摘要: requests模块是Python中发送网络请求的一款非常简洁、高效的模块。 pip install requests import requests requests.get("https://www.python.org/") requests.post("https://www.python. 阅读全文

posted @ 2021-03-08 13:17 Plyc 阅读(99) 评论(0) 推荐(0) 编辑

2021年3月6日

爬虫 注意事项

摘要: 1.tbody 不可以出现在xpath表达式中 2.爬取到的文字为乱码时 name = name.encode(‘iso-8859-1’).decode(//‘gbk’) 3.# 增强xpath表达式的通用性 ****采用管道符 # url="https://www.aqistudy.cn/hist 阅读全文

posted @ 2021-03-06 15:22 Plyc 阅读(168) 评论(0) 推荐(0) 编辑

2021年3月1日

django orm 乐观锁

摘要: # 类视图 (并发,乐观锁) class MyView(View): @transaction.atomic def post(self, request): '''订单创建''' count = 3 # 订购3件商品 # 设置事务保存点 s1 = transaction.savepoint() # 阅读全文

posted @ 2021-03-01 20:37 Plyc 阅读(153) 评论(0) 推荐(0) 编辑

django orm 事务

摘要: with 语句用法: from django.db import transaction def viewfunc(request): # 这部分代码不在事务中,会被 Django 自动提交 ...... with transaction.atomic(): # 这部分代码会在事务中执行 ..... 阅读全文

posted @ 2021-03-01 16:58 Plyc 阅读(129) 评论(0) 推荐(0) 编辑

2021年2月28日

orm的增删改查

摘要: 引言假设有如下的model定义,下面将对该model对应的数据库进行增删改查操作。 class Student(): name = models.CharFiled(max_length = 30) age = models.IntegerFiled() 增 方法一: stu1 = Student( 阅读全文

posted @ 2021-02-28 12:55 Plyc 阅读(51) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 ··· 17 下一页

导航