Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.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 通过GAE头发布请求_Python_Google App Engine_Flask_Http Headers_Urllib - Fatal编程技术网

Python 通过GAE头发布请求

Python 通过GAE头发布请求,python,google-app-engine,flask,http-headers,urllib,Python,Google App Engine,Flask,Http Headers,Urllib,我从GAE Flask服务向其他GAE Flask服务发送POST请求 try: service_url = 'http://localhost:4040/getservice' headers = { 'Content-Type': 'application/json', 'Cache-Control': 'no-cache', 'Auth-Key': AUTH_KEY, 'Customer': str(CUSTO

我从GAE Flask服务向其他GAE Flask服务发送POST请求

try:
    service_url = 'http://localhost:4040/getservice'
    headers = {
        'Content-Type': 'application/json',
        'Cache-Control': 'no-cache',
        'Auth-Key': AUTH_KEY,
        'Customer': str(CUSTOMER)
    }

    s = Session()
    req = requests.Request('POST', service_url, data=conf, headers=headers)
    readytogo = req.prepare()

    #del readytogo.headers['Content-Lenght']
    #del readytogo.headers['Host']

    module = s.send(readytogo)

except Exception as e:
    print('error')
    print(e)
    return e
但我有一个错误:

Stripped prohibited headers from URLFetch request: ['Host', 'Content-Length']


如果我删除了该标题我在控制台中有此错误:

error
'content-lenght'
第页中出现此错误:

An internal error occurred:
'exceptions.KeyError' object is not callable
See logs for full stacktrace.
GAE不支持标题内容长度和主机!
如何将POST请求从GAE发送到其他GAE端点???

您在删除标题的语句中有一个输入错误,这就是导致错误的原因:

del readytogo.headers['Content-Lenght']
而不是

del readytogo.headers['Content-Length']