Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 通过代理在Google应用程序引擎上发布HTTP帖子_Python_Google App Engine_Http_Post_Proxy - Fatal编程技术网

Python 通过代理在Google应用程序引擎上发布HTTP帖子

Python 通过代理在Google应用程序引擎上发布HTTP帖子,python,google-app-engine,http,post,proxy,Python,Google App Engine,Http,Post,Proxy,我无法通过Google App Engine中的代理发出任何HTTP POST请求,httplib(set_tunnel,似乎不受支持:)或urllib2 事实上,在本地测试中,无论请求是否有效,至少返回了一些东西,我不知道是通过代理还是直接(使用httplib(set_tunnel)和urllib2),但当我将更改上传到谷歌服务器时,什么都不起作用 我用于发出请求的功能包括: def __urllib2Post(self, post_args, tokenizer): Post = u

我无法通过Google App Engine中的代理发出任何HTTP POST请求,httplib(set_tunnel,似乎不受支持:)或urllib2

事实上,在本地测试中,无论请求是否有效,至少返回了一些东西,我不知道是通过代理还是直接(使用httplib(set_tunnel)和urllib2),但当我将更改上传到谷歌服务器时,什么都不起作用

我用于发出请求的功能包括:

def __urllib2Post(self, post_args, tokenizer):
    Post = urllib.urlencode(post_args, doseq=True)
    headers = {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)", 
                #"Host": "servicios.mitele.es", 
                #"Accept-Encoding": "gzip", 
                "Accept-Charset": "ISO-8859-1,UTF-8;q=0.7,*;q=0.7", 
                "Referer": "http://static1.tele-cinco.net/comun/swf/playerMitele.swf",
                "Connection": "close", 
                "Accept-Language": "de,en;q=0.7,en-us;q=0.3", 
                "Content-type": "application/x-www-form-urlencoded"
                }
    url = "http://servicios.mitele.es" + tokenizer
    proxy_h = urllib2Local.ProxyHandler({"http" : "80.58.250.68:80"})
    opener = urllib2Local.build_opener(proxy_h)  
    urllib2Local.install_opener(opener)  
    req = urllib2Local.Request(url, Post, headers)
    response = urllib2Local.urlopen(req)
    return response.read()

def __post(self, post_args, tokenizer):
    Post = urllib.urlencode(post_args, doseq=True)
    headers = {
                "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0)", 
                #"Host": "servicios.mitele.es", 
                #"Accept-Encoding": "gzip", 
                "Accept-Charset": "ISO-8859-1,UTF-8;q=0.7,*;q=0.7", 
                "Referer": "http://static1.tele-cinco.net/comun/swf/playerMitele.swf",
                "Connection": "close", 
                "Accept-Language": "de,en;q=0.7,en-us;q=0.3", 
                "Content-type": "application/x-www-form-urlencoded"
                }
    #conn = httplib.HTTPConnection("213.4.97.107", 80)
    conn = httplib.HTTPConnection("servicios.mitele.es", 80)
    conn.set_tunnel("80.58.250.68", 80, headers)
    conn.request("POST", tokenizer, Post, headers)
    response = conn.getresponse()

    #print response.status, response.reason
    if response.status == 404: #NOT FOUND
        data = None
    elif response.status == 400: #BAD REQUEST
        data = None
    else:
        data = response.read()
    conn.close()
    return data
我需要这样做,因为我有一个网站,可以找到西班牙主要电视台网站视频的下载链接,有些网站在地理位置上被锁定,我需要通过西班牙代理提出请求。我不能使用web代理,因为请求必须是POST格式

有没有办法通过谷歌应用引擎中的代理来执行HTTP POST请求

非常感谢你的帮助。。对不起我的英语