互联网存档(archive.org)python包代理/ vpn问题

问题描述 投票:0回答:1

在我的 vpn 后面,http 代理:127.0.0.1:8118,我只是想从网站上的 ia 包的快速入门中获取示例:

https://archive.org/developers/tutorial-find-identifier-item.html https://github.com/jjjake/internetarchive/tree/master/internetarchive

Standalone,这总是工作正常,(所以我相信问题出在包而不是我的电脑上):

requests.get('http://google.com', proxies={'https'=127.0.0.1:8118'})

//ia 使用 HTTPS

我试过设置环境变量 HTTPS_PROXY:

HTTPS_PROXY='http://127.0.0.1:8118' 

我只是想从网站上获取第一个工作示例(从 vpn 后面),非常简单:

from internetarchive import get_item
  md = {'collection': 'test_collection', 'title': 'My New Item', 'mediatype': 'movies'}
  r = item.upload('<identifier>', files=['film.txt', 'film.mov'], metadata=md, access_key='YoUrAcCEssKey', secret_key='youRSECRETKEY')
  r[0].status_code

我一直在 ia 包周围挖掘在 requests.get(..., proxies={'http':127.0.0.1:8118' }) 中输入代理变量的地方,并在没有运气的情况下运行测试。 .

我在这里仍然没有运气。有什么建议吗?

python python-3.x proxy vpn archive
1个回答
0
投票
session = internetarchive.ArchiveSession()
proxies = {'https': 'http://localhost:8888', 'http': 'http://localhost:8888'}
session.proxies.update(proxies)
© www.soinside.com 2019 - 2024. All rights reserved.