标题:爬虫-requests-post
取消只看楼主
zz12306
Rank: 1
等 级:新手上路
帖 子:6
专家分:4
注 册:2023-3-17
 问题点数:0 回复次数:1 
爬虫-requests-post
大佬们帮忙看看真的是咋回事啊,,《python3网络爬虫开发实战》52页代码
代码:

import requests
data={'name':'germey','age':'25'}
r=requests.post("https:www.,data=data)
print(r.text)

显示错误代码:
Traceback (most recent call last):
  File "D:\pythonProject1\爬虫\52.py", line 3, in <module>
    r=requests.post("http:www.,data=data)
  File "D:\python310\lib\site-packages\requests\api.py", line 115, in post
    return request("post", url, data=data, json=json, **kwargs)
  File "D:\python310\lib\site-packages\requests\api.py", line 59, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\python310\lib\site-packages\requests\sessions.py", line 573, in request
    prep = self.prepare_request(req)
  File "D:\python310\lib\site-packages\requests\sessions.py", line 484, in prepare_request
    p.prepare(
  File "D:\python310\lib\site-packages\requests\models.py", line 368, in prepare
    self.prepare_url(url, params)
  File "D:\python310\lib\site-packages\requests\models.py", line 445, in prepare_url
    raise InvalidURL(f"Invalid URL {url!r}: No host supplied")
requests.exceptions.InvalidURL: Invalid URL 'http:www.': No host supplied

搜索更多相关主题的帖子: post line url data File 
2023-03-18 18:30
zz12306
Rank: 1
等 级:新手上路
帖 子:6
专家分:4
注 册:2023-3-17
得分:0 
回复 2楼 sheeboard
谢谢大佬
2023-03-18 18:39



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-511589-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.128230 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved