当前位置: 首页 > news >正文

免费网站建设的基本流程ps做网站的分辨率多少

免费网站建设的基本流程,ps做网站的分辨率多少,潍坊哪里能找到做网站的,学校网站建设招聘flask 是一门使用 python 编写的后端框架。 VUE前端UI装饰推荐学习Element组件库 之后就不使用UI去测试flask了,环节太多,影响直观反映,直接使用postman或request测试更加直观. url携带参数 app.route(/my/blog/blog_id)def blog_detail(blog_id): # put applicatio…flask 是一门使用 python 编写的后端框架。 VUE前端UI装饰推荐学习Element组件库 之后就不使用UI去测试flask了,环节太多,影响直观反映,直接使用postman或request测试更加直观. url携带参数 app.route(/my/blog/blog_id)def blog_detail(blog_id): # put applications code herereturn 您访问的博客是{}.format(blog_id)flask里的requests方法 要获取来自前端的参数可以使用request.args.get方法。 有时候我们需要在前端没有传递该参数时设置一个默认值。这个时候可以使用request.args.get的第二个参数。下面是设置默认值的代码 age request.args.get(‘page’, default18) from flask import Flask,requestapp.route(/book/list)def book_detail(): # put applications code herepage request.args.get(page, default1, typeint)return 你获取的是{}.format(page)在前端有时候我们需要传递多个参数例如下面的代码 http://localhost:5000/login?usernamepython123password12345 这里username和password都是需要获取的参数。我们可以分别使用request.args.get方法获取各个参数 username request.args.get(username) password request.args.get(password)http://localhost:5000/search?keywordspythonkeywordsflaskkeywordswebpage1 keywords request.args.getlist(keywords) page request.args.get(page)可以将获取的值转换成int page int(request.args.get(page, default1))http://localhost:5000/search?is_validtrue 获取boole值 is_valid request.args.get(is_valid, defaultfalse) truerequest.form.get(key, typestr, defaultNone) //获取表单数据 request.args.get(key) //获取get请求参数 request.values.get(key) //获取所有参数我们用代码的方式去展示 C/S模式 Client requests是一个Python第三方库用于发送HTTP请求。它提供了一种简单而优雅的方式来发送HTTP/1.1请求并且可以自动处理 连接池,重定向等问题。requests库可以在Python 2.7和Python 3中使用支持HTTP和HTTPS请求支持Cookie、代理、SSL证书验证等功能。 使用requests库可以方便地发送GET、POST、PUT、DELETE等请求并且支持上传文件和发送JSON数据等操作。通过requests库我们可以轻松地与Web服务进行交互获取数据或提交数据。requests库已经成为Python中最常用的HTTP客户端库之一被广泛应用于Web开发、数据分析、爬虫等领域。 python request 的使用 pip3 install requests 方法2源码安装 下载 requests源码 http://mirrors.aliyun.com/pypi/simple/requests/ 下载文件到本地之后解压到Python安装目录之后打开解压文件 运行命令行输入python setup.py install 即可安装 Server app.route(/) def hello_world():return Hello World!Client requests.request(url) 构造一个请求支持以下各种方法 requests.get() 发送一个Get请求 requests.post() 发送一个Post请求 requests.head() 获取HTML的头部信息 requests.put() 发送Put请求 requests.patch() 提交局部修改的请求 requests.delete() 提交删除请求import requests ip 192.168.0.100 port 5000 url http:// ip : port print(url) r requests.get(url) print(code) print(r.status_code) print(type(r.status_code)) print(header) print(r.headers) print(type(r.headers)) print(content) print(r.headers) print(type(r.headers)) print(text) print(r.text) print(type(r.text))http://192.168.0.100:5000 code 200 class ‘int’ header {‘Server’: ‘Werkzeug/3.0.0 Python/3.10.11’, ‘Date’: ‘Tue, 07 Nov 2023 07:25:38 GMT’, ‘Content-Type’: ‘text/html; charsetutf-8’, ‘Content-Length’: ‘12’, ‘Connection’: ‘close’} class ‘requests.structures.CaseInsensitiveDict’ content {‘Server’: ‘Werkzeug/3.0.0 Python/3.10.11’, ‘Date’: ‘Tue, 07 Nov 2023 07:25:38 GMT’, ‘Content-Type’: ‘text/html; charsetutf-8’, ‘Content-Length’: ‘12’, ‘Connection’: ‘close’} class ‘requests.structures.CaseInsensitiveDict’ text Hello World! class ‘str’ Client Head r.headers print(type(Head)) print(type(r.headers)) if Content-Type in Head:print(B)B Head.get(Content-Type)print(B)print(type(B))class ‘requests.structures.CaseInsensitiveDict’ class ‘requests.structures.CaseInsensitiveDict’ B text/html; charsetutf-8 class ‘str’ url url /user/login print(url) auth {userName : admin,password : 123456 } r requests.post(url,jsonauth) print(r.status_code) print(r.content)print( r.json() ) print( type(r.json() ) ) print(r.json().get(data).get(token) )http://192.168.0.100:5000/user/login 200 b’{\n “code”: 0,\n “data”: {\n “token”: “666666”\n }\n}\n’ {‘code’: 0, ‘data’: {‘token’: ‘666666’}} class ‘dict’ 666666 urlB url /user/info print(urlB) headers {token: 666666,Content-Type: application/json }response requests.request(POST, urlB, headersheaders) print(response.text) print(response.json().get(data).get(realName).encode(utf-8).decode(gbk))http://192.168.0.100:5000/user/info { “code”: 0, “data”: { “id”: “1”, “realName”: “\u5f20\u4e09”, “userName”: “admin”, “userType”: 1 } } 张三 server app.route(/book/list, methods[GET, POST]) def book_detail():page request.args.get(page,default1,typeint)return you get is {}.format(page)client urlC url /book/list ?pagez print(urlC) r requests.request(GET,urlC) print(r.status_code) print(r.text)传输的不是规定的类型,就会按照default赋值 http://192.168.0.100:5000/book/list?pagez 200 you get is 1
http://www.hkea.cn/news/14391034/

相关文章:

  • 专业的聊城网站建设wordpress插件的开发
  • 分销网站集团门户网站建设企业
  • 网站资料上传wordpress文章中加入搜索框
  • 重庆消防网seo教程seo官网优化详细方法
  • 徐州模板建站哪家好推广一个app的费用
  • 农家乐网站开发项目背景wordpress主题瀑布流下载
  • 给公司做网站需要华多少钱系统优化app最新版
  • 如何做竞价网站数据监控我的长沙app
  • 网站开发专业职称有哪些洛阳青峰网络公司网站建设
  • 一般做兼职在哪个网站seo品牌
  • 中国空间站朋友圈柳河县建设局网站
  • 中国外贸网站大全wordpress主题 关键字代码
  • 网站建设首页怎么弄wordpress 分页太慢
  • 深圳做网站 百度智能小程序手机登录wordpress
  • 网页建站网站北京影视宣传片拍摄公司
  • 没有服务器如何做网站linux 网站301
  • 合肥浦发建设集团网站网站排名点击工具
  • 个人网站模板吧微信号注册官方网站
  • php网站源码站长工具同大全站
  • 港口建设申报网站做网站借用网络图片不违法吧
  • 企业网站建设示范平台广州软件开发招聘
  • 遵义原创网站工业软件开发技术学什么
  • 云集网站建设公司仟亿网络科技工作室
  • 安徽网站建设价格蒙牛企业网站建设(分析)与推广
  • 网站关键词 分隔网络编程课程
  • 网站注东莞网站建设手袋加工
  • 代码共享网站动漫技术制作专业
  • 企业网站报价模板下载对方把我的网站他网站内页友情链接 站长工具检测到是无反链
  • 惠州建设企业网站asp.net 如何设置网站首页
  • 湖南网站营销seo哪家好企业网站建设开发多少钱