requests.post返回HTTP 200 python

时间:2015-08-27 11:36:55

标签: python python-2.7 rest

关注getdrip api docs。我正在尝试使用POST创建新订阅者。 但requests.post返回200而不是201。

我的代码,

>>> import requests
>>> url = 'http://api.getdrip.com/v2/<id_here>/subscribers'
>>> payload = {'email': 'nishant@gmail.com', 'custom_fields': {'name':'Nishant'}}
>>> headers = {'Authorization': 'Bearer TOKEN_VALUE','Content-Type':'application/vnd.api+json'}
>>> requests.post(url, headers=headers, data=payload)
/home/nishant/env/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
<Response [200]>
>>> 

我在这里做错了什么?

1 个答案:

答案 0 :(得分:1)

文件说:

  

本文档概述了Drip RESTful API的官方规范。此API仅通过SSL(HTTPS)以JSON方式进行通信。所有端点URL均以https://api.getdrip.com/v2/开头。