Python 3.x 如何处理url:和';隧道连接失败:需要407代理身份验证';

Python 3.x 如何处理url:和';隧道连接失败:需要407代理身份验证';,python-3.x,twitter,tweepy,sttwitterapi,Python 3.x,Twitter,Tweepy,Sttwitterapi,我正在尝试使用python和Tweepy获取Twitter追随者数据。但是我经常遇到一个异常,不知道为什么会发生以及如何处理。有人能帮我解决这个问题吗。还有,当光标获取帐户中的最后一个跟随者时,如何停止循环 错误: TTPSConnectionPool(host='api.twitter.com',port=443):url:/1.1/followers/list.json?cursor=1516792635609098963&id=%40Careers超过了最大重试次数(由ProxyError

我正在尝试使用python和Tweepy获取Twitter追随者数据。但是我经常遇到一个异常,不知道为什么会发生以及如何处理。有人能帮我解决这个问题吗。还有,当光标获取帐户中的最后一个跟随者时,如何停止循环

错误: TTPSConnectionPool(host='api.twitter.com',port=443):url:/1.1/followers/list.json?cursor=1516792635609098963&id=%40Careers超过了最大重试次数(由ProxyError('Cannot connect to proxy')、OSError('Tunnel connection failed:407 proxy Authentication Required')引起)

代码


你在使用代理吗?是的,我在使用我的组织网络,在那里我们必须使用代理。当我等待每次获取数据的时间为5秒时,没有任何问题。但是没有等待,我就错了。
def process_follower(follower,i):
Mycode

consumer_key = '*********'
consumer_secret = ''********''
access_token = ''********************''
access_token_secret = ''************''

import sys
import os
import tweepy
import time

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)

api = tweepy.API(auth, wait_on_rate_limit=True, wait_on_rate_limit_notify=True)

get_user_to_query = 'Accountname'

f = open('Account_followers_Location04012017.json', 'w', encoding='utf-8', errors="surrogateescape")

try:
for follower in tweepy.Cursor(api.followers, id = get_user_to_query).items():
#print(follower.name)
process_follower(follower, i)
except Exception as e:

print(e) 
f.close()