摘要: import requests #登录 def login(): url='http://49.234.14.39:5001/user/login' data={ "password": "123456", "username": "admin" } ret=requests.request('po 阅读全文
posted @ 2022-07-09 17:28 爱coding的果妈 阅读(319) 评论(0) 推荐(0)
摘要: import requests # json格式的,第一种请求方式 # response = requests.get(url='http://www.httpbin.org/get?k1=v1&k2=v2') #将参数拼接到url中,?后是参数 # print(response.status_co 阅读全文
posted @ 2022-07-09 17:13 爱coding的果妈 阅读(90) 评论(0) 推荐(0)
摘要: import requests # response=requests.get('http://www.baidu.com') # print(response.status_code) # response.encoding='utf-8' # 指定编码格式 # # print(response. 阅读全文
posted @ 2022-07-09 16:56 爱coding的果妈 阅读(47) 评论(0) 推荐(0)
摘要: from datetime import datetime # print(datetime.now()) # 直接获取当前时间 # print(datetime.utcnow()) # 获取格林威治时间 # dt=datetime.now() # print(dt.year) # print(dt 阅读全文
posted @ 2022-07-09 16:53 爱coding的果妈 阅读(23) 评论(0) 推荐(0)
摘要: import sys # print(sys.modules) # 描述当前执行代码的位置,解释器中导入的所有模块都被放到字典里 # import time # print(time.time()) # print(sys.modules['time'].time()) # print(time.t 阅读全文
posted @ 2022-07-09 16:52 爱coding的果妈 阅读(23) 评论(0) 推荐(0)
摘要: 是一种高级用法requests.Session() 可以用来帮助我们保持会话登录后,进行新增操作,不用传cookies值 class CRM(): _session = requests.Session() # 保持登录,不用传cookies值 def login(self): data = { ' 阅读全文
posted @ 2022-07-09 16:50 爱coding的果妈 阅读(20) 评论(0) 推荐(0)
摘要: json是干什么的 把一个东西变成序列 有序的叫序列 {'a','b'} # 集合是散列json.dumps()做序列化,转成字符串格式(json串) import json # dic={ # "operate":"login", # 必须用双引号 # "username":"admin", # 阅读全文
posted @ 2022-07-09 16:47 爱coding的果妈 阅读(35) 评论(0) 推荐(0)