第二步任务 2
请你告诉服务器你的名字是什么,你的学号是什么。名字使用字段name,学号使用字段student_number。请把以上信息以GET方式交到以下地址:

http://xxx/step_02

参考:https://blog.csdn.net/mack415858775/article/details/39696107
参考:https://blog.csdn.net/qq_41990031/article/details/101386139
参考:https://blog.csdn.net/lusongno1/article/details/51592402
参考:https://www.pianshen.com/article/77401339099/
参考:https://www.cnblogs.com/wbw-test/p/11580887.html 无需转换的汉字
成功

import urllib.request
import urllib.parse
import urllib.response
url = 'http://xxx/step_02?name=ChengZheng&student_number=填自己学号'
req = urllib.request.Request(url)
print(req)
res_data = urllib.request.urlopen(req)
res = res_data.read()
print(res)

python有post以及get两种方式:使用get方式时,请求数据直接放在url中,使用post方式时,数据放在data或者body中,不能放在url中,放在url中将被忽略。

url = 'http://xxx/step_02?' #问号需要有
values = {'name': '辰筝', 'student_number': '01111111'}
values = urllib.parse.urlencode(values) #可将汉字转换使web可接受
full_url = url + values

传递汉字

第三步
阅读以下材料,找出提示
链接: https://pan.baidu.com/s/13hA8vTXkY0aI8460qBT_qw
材料有关公钥加密、模幂计算
最后给了:http://<server>/context/f64710b4861e6ff10678036548bf7afa
用之前的代码就可访问

import urllib.request
response = urllib.request.urlopen('http://xxx/context/f64710b4861e6ff10678036548bf7afa')
html = response.read()
print(html)

获得加密信息后进行解密

来源:辰筝

物联沃分享整理
物联沃-IOTWORD物联网 » 五子棋day2

发表评论