-
2 votesanswersviews
请求拒绝证书
我可以使用 curl 或谷歌浏览器访问 https://siscourses.ethz.ch/python_dbiol/data/logistic_data.txt ,而不会对证书提出任何投诉 . 如果我跑 import requests request.get("https://siscourses.ethz.ch/python_dbiol/data/logistic_data.txt... -
1 votesanswersviews
Python lxml xpath无输出
出于教育目的,我试图使用lxml和Python中的请求来抓取this page . 具体来说,我只想在页面上打印所有教授的研究领域 . 这是我到目前为止所做的 import requests from lxml import html response=requests.get('http://cse.iitkgp.ac.in/index.php?secret=d2RkOUgybWlNZzJwQ... -
0 votesanswersviews
多参数curl请求Python,Spotify API
我正在尝试执行Spotify API的curl请求 . 从我所看到的你可以使用请求库,但我不知道如何解释Authorization参数 . 以下是卷曲请求 - 非常感谢任何帮助! curl -X GET“https://api.spotify.com/v1/audio-features/06AKEBrKUckW0KREUWRnvT " -H "授权:Bearer {您的访问令牌... -
1 votesanswersviews
Spotify Web API - 错误400,播放列表创建时没有正文
我正在尝试使用Spotify Web API创建和填充播放列表 . 我正在关注this官方参考,我正在使用带有请求模块的Python 3 . 这是我的代码: def spotify_write_playlist(auth, name, tracks, public=True): ids = [] for track in tracks: track_id = tra... -
1 votesanswersviews
Python message.content discord bot
我想要一个帮助,我试图让我的不和谐机器人在有人写一些单词时自动响应,问题是该命令只有在这个单词是第一个写在句子中时才有效 . 我希望我的机器人能够对这个消息作出回应,即使这个词在某个句子的中间 . 我该怎么办? -
4 votesanswersviews
带有python请求库的zomato api请求
Zomato是最受欢迎的餐厅搜索引擎之一,提供免费的api服务...... 如果在api请求中使用curl,则效果很好; curl -X GET --header "Accept: application/json" --header "user_key: MY_API_KEY_HERE" "https://developers.zomato.co... -
0 votesanswersviews
使用请求模块的SSL连接
我在我的apache2中安装了SSL证书,它可以在浏览器中正常工作 . SSLCertificateFile /root/ca/intermediate/certs/www.example.com.cert.pem SSLCertificateKeyFile /root/ca/intermediate/private/www.example.com.key.pem SSLCertifica... -
1 votesanswersviews
如何在fiddler中捕获python https流量?
当我尝试执行一些数据获取任务时,Python会抛出错误 . 这只有在我设置fiddler解密https流量时才会发生 . 我尝试通过127.0.0.1:8888路由python流量,并与mozilla一样,以便捕获其流量 . 我也安装了证书,并通过提琴手信任它,我不知道我哪里出错了 . raise SSLError(e, request=request) requests.exceptio... -
0 votesanswersviews
hTried和失败 . 无法导入新安装的模块“请求”
/ tmp $ pip -V来自/usr/lib/python2.6/site-packages(python 2.6)的pip 7.1.0 / tmp $ python -VPython 2.6.6 / tmp $ pip在/ usr / bin中/ PIP / tmp $是哪个python在/ usr / bin中/蟒蛇 / tmp $ pip安装请求要求已经满足(使用--upgrade升级)... -
4 votesanswersviews
限制并发请求数aiohttp
我正在使用aiohttp下载图像,并想知道是否有办法限制尚未完成的打开请求的数量 . 这是我目前的代码: async def get_images(url, session): chunk_size = 100 # Print statement to show when a request is being made. print(f'Making request ... -
3 votesanswersviews
Google API上的Google API配额自动填充功能
我正在开发一个我想使用的应用程序Google API place autocomplete . 看起来每个Google API每天只能使用2 500个请求,即使下一页API Google Maps for Work中未提及此特殊API . 我的问题是: 他们如何使用此API计算请求? 一个字母=一个请求 一个字母=多个请求(列表中每个字段一个) 一个请求=地址完成后点击列表 也许请... -
2 votesanswersviews
使用Python中的asyncio并行化Web任务
我正试图围绕asyncio和aiohttp,并且多年来第一次编程让我觉得完全愚蠢和无能为力 . 这是一种美丽的,以古怪的禅宗方式 . 但是,唉,还有很多工作要做 . 我有一个现有的课程,可以在网上做很多奇妙的事情,比如注册网站,获取数据,工作 . 现在我需要100或1000个这样的小工蜂来报名 . 代码看起来大致如下: class Worker(object): def signup(se... -
-2 votesanswersviews
看似“垃圾”的结果与请求
我有this网页 . 当我尝试使用 requests 模块获取其html时: import requests link = "https://www.worldmarktheclub.com/resorts/7m/" f = requests.get(link) print(f.text) 我得到这样的结果: <!DOCTYPE html> <html&g... -
-2 votesanswersviews
如何从html直接发送文件到python脚本
/upload.html 在这里我想直接在python脚本中发送一个文件ieimage并读取一个脚本内的文件 . 基本上我想读取该脚本中的文件并将结果放入html <html> <head> <title>Upload File</title> </head> <body> &l... -
0 votesanswersviews
如何在虚拟环境中运行cronjob for python脚本请求lib进行curl req?
我有一个python脚本,它使用请求lib对网址发出curl请求并获得响应 . 当我手动运行它时,它能够获取响应对象并更新var值 . 还为脚本设置了虚拟环境 . 脚本如下: #! /bin/bash source myEnv/bin/activate python /Users/mj/req.py 和crontab如下: */1 * * * * /Users/mj/Enviroments/m... -
0 votesanswersviews
nasdaq.com的帖子请求不正确
所以我试图从纳斯达克获得10年的历史数据 . 默认时间段为3个月,当将其更改为10年并检查页面源时,发布请求的数据/有效负载字典为“10y | false | FB” The data is publically available and can be downloaded as excel sheets. 我收到的回复请求仍然是3个月而不是10年 . 谁能告诉我这里有什么问题?谢谢! url ... -
1 votesanswersviews
Python 3 TypeError:utf_8_encode()必须使用Requests而不是字节
我正在尝试获取需要登录名和密码才能访问的.txt页面的内容 . 我试图通过页面并打印其内容时得到一个TypeError: TypeError: utf_8_encode() argument 1 must be str, not bytes 我访问此数据的代码是: import requests with requests.Session() as c: url = 'https... -
0 votesanswersviews
Python Requests模块,Json和API
我需要识别API中的"account_type"列为"Unknown"而不是API中的"Linked"的任何帐户 . 然后我需要将我们识别为"Unknown" "account_type"的"owner_id"字段与csv中列出的owner_id进行比较 . 然后,我... -
2 votesanswersviews
终端不会使用BeautifulSoup显示打印响应
这是我的代码: import requests from bs4 import BeautifulSoup page = requests.get('https://web.archive.org/web/20121007172955/https://www.nga.gov/collection/anZ1.htm') soup = BeautifulSoup(page.text, 'html.p... -
0 votesanswersviews
根据用户输入生成gif
我想根据用户输入生成gif . 我可以使用以下代码生成单个gif:` def getGif(request): import time import giphy_client from giphy_client.rest import ApiException from pprint import pprint # create an instance o... -
1 votesanswersviews
re.error:missing),通过pip安装时,位置0的未终止子模式
我对编程比较陌生,我遇到了一个问题 . 我已经安装了Python 3.7和pip 10.0,但是当我尝试执行诸如安装virtualenv之类的操作时,会出现一堆错误消息 . 我导致使用easy_install,但使用pip的问题仍然存在 . 我唯一的猜测是pip的某些部分可能没有正确安装,但我尝试再次尝试卸载和安装失败 . -
1 votesanswersviews
Python请求给出了词汇JSON错误 . 如何解决这个问题?
我正在尝试在python中构建一个动态请求并发送它,但我收到错误 - “你提交的JSON中存在一个问题:词法错误:json文本中的char值无效 . ” 我的代码: headers = { 'Content-Type': 'application/json', 'Accept': 'application/json', 'Authorization': 'auth_token ' + auth_t... -
0 votesanswersviews
无法访问需要使用python中的请求登录的网页的请求URL
我是网络抓取的新手,我无法找到问题的解决方案 . 我想从我的电子成绩簿(来自学校,'e-dnevnik')中取出所有成绩,以便我可以与他们做一些统计,但是,我被困在登录页面 . import requests POST_LOGIN_URL = 'https://ocjene.skole.hr/pocetna/prijava' # Login page REQUEST_URL = 'https:... -
1 votesanswersviews
逐帧下载MJPEG流
我有一个IP摄像头设置,我可以浏览到它的IP并获得一个MJPEG流,我正在尝试逐帧下载,以便我可以分析另一台服务器上的图像 . 但是我在阅读流时遇到了麻烦 . 我的代码是: import cv2 import urllib.request import numpy as np import ssl ctx = ssl.create_default_context() ctx.check_host... -
565 votesanswersviews
urllib,urllib2和requests模块之间有什么区别?
在Python中, urllib , urllib2 和requests模块之间有什么区别?为什么有三个?他们似乎做同样的事情...... -
391 votesanswersviews
使用Python请求发布JSON
我需要将JSON从客户端POST到服务器 . 我正在使用Python 2.7.1和simplejson . 客户端正在使用请求 . 服务器是CherryPy . 我可以从服务器获取硬编码的JSON(代码未显示),但是当我尝试将JSON发送到服务器时,我得到“400 Bad Request” . 这是我的客户端代码: data = {'sender': 'Alice', 'receive... -
279 votesanswersviews
如何使用请求下载图像
我'm trying to download and save an image from the web using python' s requests 模块 . 这是我使用的(工作)代码: img = urllib2.urlopen(settings.STATICMAP_URL.format(**data)) with open(path, 'w') as f: f.write(i... -
369 votesanswersviews
ImportError:没有名为requests的模块
每当我尝试导入requests时,我都会收到错误说 No module Named requests . import requests 我得到的错误: File "ex2.py", line 1, in <module> import requests ImportError: No module named requests -
0 votesanswersviews
请求库和Pip Ntlm代理设置问题 . - Python
问题 我无法让python请求库,easy_install或pip在公司代理后面工作 . 但是,我可以让git工作 . 我是如何让git工作的 我设置了git代理设置 git config --global http.proxy http:// proxyuser:proxypwd@proxy.server.com:8080 我工作的公司代理服务器需要用户名和密码,而且格式正确 http... -
1 votesanswersviews
无法使用python-requests获取带有“Content-Disposition:attachment;”的网页
使用我的firefox浏览器,我登录到一个下载站点并单击其中一个查询按钮 . 弹出一个小窗口,名为“打开report1.csv”,我可以选择“打开方式”或“保存文件” . 我保存文件 . 对于这个动作Live HTTP headers告诉我: https:// myserver / ReportPage?download&NAME = ALL&DATE = THISYEAR GET / Repo...