ICode9

精准搜索请尝试: 精确搜索
  • 如何在Python请求中使用cookie2019-09-17 22:07:36

    我正在尝试登录页面并访问页面中的其他链接. payload={'username'=<username>,'password'=<password>} with session() as s: r = c.post(<URL>, data=payload) print r print r.content 这给了我一个“405 Not Allowed”错误. 我使用chrome开发人员工具查看了post

  • python – MaxRetryError:HTTPConnectionPool:超出最大重试次数(由ProtocolError引起(‘连接中止.’,错误(111,’拒绝连接’)))2019-09-15 22:57:27

    我有一个问题:我想测试“选择”和“输入”.我可以像下面的代码一样编写它: 原始代码: 12 class Sinaselecttest(unittest.TestCase): 13 14 def setUp(self): 15 binary = FirefoxBinary('/usr/local/firefox/firefox') 16 self.drive

  • python – 请求中的URL超出了最大重试次数2019-09-15 17:59:12

    我正在尝试获取App Store > Business的内容: import requests from lxml import html page = requests.get("https://itunes.apple.com/in/genre/ios-business/id6000?mt=8") tree = html.fromstring(page.text) flist = [] plist = [] for i in range(0, 100): app

  • 使用requests.post登录导致“错误405不允许”2019-09-10 15:56:53

    我的目标是从consumerreports.com获取数据,因此我正在为此项目使用“请求”和“beautifulsoup”.除了Web浏览,我在通过请求成功登录consumerreports.com时遇到了很多麻烦. 这是我的代码:我创建了两个文本文件,其中我写了帖子和响应,所以我可以检查它是否成功登录. import requests

  • 使用Python“请求”库,如何判断ConnectionError是客户端还是服务器端?2019-09-01 10:57:25

    这是我现在丑陋的小代码片段: for i in range(5): try: self.startTime=time.time() self.rawfeed=requests.get(self.feedurl) continue except ConnectionError: print "Got a connection error. Retrying"

  • 使用Python’请求’登录和上传文件2019-08-31 19:09:30

    我需要登录并上传文件.我面临的问题是,登录页面与上传页面不同.如果我必须手动完成,我将登录(login.php)到该站点,然后导航到上传页面(uploader.php)以上传文件.这就是我写的: import requests url1='http://www.abc.com/login.php' r = requests.post(url1, auth=('uname', 'pwor

  • python – 请求获取图像,通过烧瓶返回2019-08-31 17:09:03

    我试图通过请求获取图像并从烧瓶应用程序返回该图像.我没有运气从请求中读取二进制数据,我得到的响应总是0字节. @app.route('/image') def get_image: zs = requests.Session() r = zs.get( 'url_that_loads_a_png' ) fr = make_response( r.raw.read() ) fr.hea

  • 使用python Requests.Session()的连续请求不起作用2019-08-31 15:07:48

    我试图这样做, import requests s=requests.Session() login_data = dict(userName='user', password='pwd') ra=s.post('http://example/checklogin.php', data=login_data) print ra.content print ra.headers ans = dict(answer='5') f

  • python – 机器人框架传递cookie以获取请求(RequestsLibrary) – TypeError2019-08-28 14:08:35

    我需要将cookie值传递给Get request关键字以使其正常工作,但它仍然失败.我不知道如何在那里正确传递它.关键字的文档说明了标题:“标题:与请求一起使用的标题字典” 我使用Library RequestsLibrary进行了这样的测试: Check request and response Do Local Login ${username}

  • 如何通过python-3.6在网站html中搜索?2019-08-27 21:59:18

    我有很多礼物,我需要创建检查器,这将检查,如果礼物是否工作 – >它会在html中搜索一些单词.我正在寻找“礼品代码无效” 当我尝试通过urllib或请求读取html时,它只会加载一小部分html.我是初学者,所以我可能做错了. 我的代码是: import requests link = "https://discord.gift/o2uz

  • Python请求中的SSLError(读取操作超时)2019-08-25 03:57:27

    我有一个python API脚本,尽管使用了try / except,我的脚本有时会在此行终止.这是代码: try: r = requests.post(URL, data=params, headers=headers, timeout=self.request_timeout) try: response = r.json() except Exc

  • 无法使用python-requests发布文件数据2019-08-24 10:56:15

    我可以使用curl发布文件 curl -X POST -i -F name='barca' -F country='spain' -F file=@/home/messi/Desktop/barca.png 'http://localhost:8080/new_org/hel/concerts' 我可以得到(文件) curl -X GET -H 'Accept: image/png' 'http://loc

  • 如何从烧瓶发送和接收数据?2019-08-24 07:57:01

    我试图将从client.py创建的python字典发送到我的webservice,让webservice对数据执行某些操作,并将一个布尔值返回给client.py.这是我到目前为止服务器和客户端的代码: 服务器端(在webservice.py内): from flask import Flask from flask import request import json app = Flask(__

  • python – 令人困惑的无法使用请求进行身份验证:NoneType错误2019-08-24 00:08:56

    我没有看到其他人有这个问题,它似乎已经出现了我.那么我如何确定这是一个本地安装问题还是(我非常怀疑这个)库的问题? 使用请求,我已经运行基本身份验证一段时间没有问题.但今天我发现我根本无法进行身份验证. 所以,如果我: import requests s = requests.Session() s.auth('usernam

  • python – 将POST从请求转换为GAE urlfetch2019-07-28 07:59:48

    我正在用PayPal付款.以下是它如何正常处理请求: res = requests.post(get_payment_info_url, headers=headers, data=params) res_data = res.json() 但是当我尝试使用urlfetch执行相同的请求时,它会给我一个错误(来自PayPal的200响应,但付款失败): res = urlfetch.fetch(url=make

  • 为什么python请求抛出此BadStatusLine异常2019-07-27 10:58:52

    在python中,如果我导入请求并执行: t = requests.get("http://www.azlyrics.com/u/urban.html") 我得到这个例外: raise BadStatusLine(line) http.client.BadStatusLine: '' 有谁知道如何解决这一问题?解决方法:可以有different reasons for this kind of error,但在这种特殊情况

  • python – 使用请求发布上传的文件2019-07-24 22:58:33

    我在Flask中从HTML表单接收文件,并希望使用请求将其发布到其他服务.在目标服务中,传入请求不包含该文件.如何发布上传的文件? f = request.files['file'] sendFile = {"file": FileStorage(filename=f.filename, stream=f.stream, content_type=f.content_type, content_length=act

  • Python没有权限在此服务器上访问/从ZIP返回城市/州2019-07-24 20:56:38

    我想要做的是从邮政编码中检索城市和州.这是我到目前为止所拥有的: def find_city(zip_code): zip_code = str(zip_code) url = 'http://www.unitedstateszipcodes.org/' + zip_code source_code = requests.get(url) plain_text = source_code.text index = p

  • python – gevent / requests在发出大量头部请求时挂起2019-07-22 17:56:42

    我需要发出100k头请求,并且我在请求之上使用gevent.我的代码运行了一段时间,但最终挂起.我不知道为什么它会挂起,或者它是否挂在请求或gevent中.我在请求和gevent中都使用了timeout参数. 请看下面的我的代码片段,让我知道我应该改变什么. import gevent from gevent import monkey

  • 使用Python requests.get来解析一次不加载的html代码2019-07-22 16:58:04

    我正在尝试编写一个Python脚本,该脚本将定期检查网站以查看项目是否可用.我过去成功使用了requests.get,lxml.html和xpath来自动化网站搜索.对于此特定URL(http://www.anthropologie.com/anthro/product/4120200892474.jsp?cm_vc=SEARCH_RESULTS#/)和同一网站上的其他人,我的代码无

  • Python请求 – 从response.text中提取数据2019-07-17 15:56:54

    我现在已经环顾了几天,无法解决这个问题.基本上我是将图像上传到服务器并获得一个ID作为回报,问题是我无法弄清楚如何提取此ID并将其更改为准备保存到数据库中的String. 程序代码 url = <Server address> with open("image.jpg", "rb") as image_file: files = {'file': image

  • Python请求给我“坏握手”错误2019-07-15 06:57:01

    像这样使用Python requests import requests; requests.get('https://internal.site.no') 给我一个错误many have had; SSLError: ("bad handshake: Error([('SSL routines', 'SSL23_GET_SERVER_HELLO', 'sslv3 alert handshake failure'

  • 使用请求python库连接Django应用程序失败的身份验证2019-07-13 15:07:10

    也许这是一个愚蠢的问题: Requests(一个python HTTP lib)是否支持Django 1.4? 我使用请求按照下面的官方快速入门: requests.get('http://127.0.0.1:8000/getAllTracks', auth=('myUser', 'myPass')) 但我从来没有得到正确的身份验证.(当然我一次又一次地检查了网址,用户名,密码.)

  • python – request.get(url)返回空内容2019-07-13 12:06:29

    我想弄清楚这一点,但没有运气: import requests r = requests.get('http://example.com/m7ppct4', allow_redirects=True) r.status_code返回200,r.content返回”. r.headers返回以下字典: {'content-length': '0', 'content-language': 'en-US

  • Python请求获得TLSV1_ALERT_INTERNAL_ERROR2019-07-11 14:57:24

    我正在尝试连接到需要使用客户端证书的请求的网站. import requests r = requests.get(url, cert='path to cert') print(r.status_code) 这适用于使用相同客户端证书的一个站点.该服务器正在使用TLS_RSA_WITH_AES_128_CBC_SHA,TLS 1.0.但是,我的目标站点使用TLS_ECDHE_RSA_WITH_

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有