Python Youtube API OAuth';d对象在与芹菜一起分发时丢失身份验证

Python Youtube API OAuth';d对象在与芹菜一起分发时丢失身份验证,python,api,oauth,youtube,celery,Python,Api,Oauth,Youtube,Celery,我使用芹菜和YouTube API来进行异步调用。我创建了一个类,其中包含Youtube服务的链接。我将该类的一个实例传递给我的所有芹菜任务,但是当我调用API时,响应是403,我最终需要为每个任务重新验证。当我在没有芹菜的情况下同步运行它时,就没有问题了 很明显,http对象正在被篡改。这可能是一个带有pickle(我目前用于序列化的内容)的问题,还是一个芹菜问题 谢谢 编辑(有关详细信息): 任务: 调度员: def test(): import httplib2 o = A

我使用芹菜和YouTube API来进行异步调用。我创建了一个类,其中包含Youtube服务的链接。我将该类的一个实例传递给我的所有芹菜任务,但是当我调用API时,响应是403,我最终需要为每个任务重新验证。当我在没有芹菜的情况下同步运行它时,就没有问题了

很明显,http对象正在被篡改。这可能是一个带有pickle(我目前用于序列化的内容)的问题,还是一个芹菜问题

谢谢

编辑(有关详细信息):

任务:

调度员:

def test():
    import httplib2
    o = ApiObj() #this connects to youtube and authorizes the http object
    h = o.http
    h.other_connections = {'test':httplib2.HTTPSConnectionWithTimeout('localhost',80,timeout=120)}
    print h
    print h.connections
    print h.other_connections
    tasks.testConection.s(o).delay()
<httplib2.Http object at 0x293e6d0>
{'https:www.googleapis.com': <httplib2.HTTPSConnectionWithTimeout instance at 0x2a12b90>, 'https:accounts.google.com': <httplib2.HTTPSConnectionWithTimeout instance at 0x2a0be60>}
{'test': <httplib2.HTTPSConnectionWithTimeout instance at 0x29bc440>}
在我的自定义api类中,我有一个Http对象(来自httplib2)。从我的任务发布者,我打印http对象中的连接,然后将该对象传递给芹菜任务,在那里我尝试再次打印它们

来自调度程序的结果:

def test():
    import httplib2
    o = ApiObj() #this connects to youtube and authorizes the http object
    h = o.http
    h.other_connections = {'test':httplib2.HTTPSConnectionWithTimeout('localhost',80,timeout=120)}
    print h
    print h.connections
    print h.other_connections
    tasks.testConection.s(o).delay()
<httplib2.Http object at 0x293e6d0>
{'https:www.googleapis.com': <httplib2.HTTPSConnectionWithTimeout instance at 0x2a12b90>, 'https:accounts.google.com': <httplib2.HTTPSConnectionWithTimeout instance at 0x2a0be60>}
{'test': <httplib2.HTTPSConnectionWithTimeout instance at 0x29bc440>}

{'https:www.googleapis.com':,'https:accounts.google.com':}
{'test':}
芹菜工人的结果:

<httplib2.Http object at 0x43b4a50>
{}
{'test': <httplib2.HTTPSConnectionWithTimeout instance at 0x3c6df80>}

{}
{'test':}
即使我将芹菜任务更改为将http对象作为参数,并将变量
h
从函数
test
传递到芹菜任务中,结果也是一样的


我开始认为这是由于google oauth的d对象被酸洗造成的。

我尝试只传递http.connections字典,我得到了以下结果:

kombu.exceptions.EncodeError:无法pickle对象
kombu.exceptions.EncodeError:JSON不可序列化
kombu.exceptions.EncodeError:无法表示对象:

问题在于对SSL对象进行酸洗,这与生俱来是不可酸洗的