用于Python的Twitter Ads SDK API。
twitter-ads-v2的Python项目详细描述
入门
安装
# install the latest release
pip install twitter-ads-v2
快速入门
^{pr2}$endpoint_type
为了提供一致的接口,每个API方法的第一个参数总是endpoint_type
:
data=client.campaigns('load',id='campaign_id')
在上面的例子中,load
是这个调用的endpoint_type
。每个endpoint_type
的术语如下所述。在
^{ | description | HTTP method |
---|---|---|
^{ | Retrieve all or some of the entities’ details depends on the request parameters from an index endpoint (i.e., most index endpoints have a parameter that can scope the results). | GET |
^{ | Retrieve a specific entity details from a show endpoint (i.e., most show endpoints require an entity id to retrieve as part of resource URI). | GET |
^{ | Create a new entity. | POST |
^{ | Update a specific entity. | PUT |
^{ | Delete a specific entity. | DELETE |
^{ | Create/Update/Delete entities depends on the POST body data (normally a JSON object). | POST |
请求参数
除上面提到的endpoint_type
之外的所有请求参数都应作为关键字参数传递。在
速率限制处理和请求重试
client=twitter_ads_v2.Client(ACCOUNT_ID,CONSUMER_KEY,CONSUMER_SECRET,ACCESS_TOKEN,ACCESS_TOKEN_SECRET,options={'handle_rate_limit':True,'retry_max':3,'retry_delay':5000,'retry_on_status':[404,500,503]})^{tb2}$
兼容性和版本控制
这个项目是为使用python3.5或更高版本而设计的。虽然它可以在其他版本的Python上运行,但下面是我们正式支持并定期测试的平台和运行时版本。在
^{3}$所有版本都遵循严格的语义版本控制。例如,主要.次要.修补-前(又名。大棒。胡萝卜。哦-窥视)。在
发展
如果你想为这个项目做贡献或者在本地尝试这个项目的一个未发布的开发版本,你可以很容易地按照下面的例子来做。在
# clone the repository git clone git@github.com:smaeda-ks/twitter-python-ads-sdk-v2.git cd twitter-python-ads-sdk-v2 # installing a local unsigned release pip install -e .
测试
$ python setup.py flake8 && python setup.py test
文档
如果您想对项目文档做出贡献,您需要按照以下步骤设置Sphinx并构建页面。在
# install dependencies $ pip install -e .[doc]# build pages $ cd sphinx/ $ make clean && make html
- 项目
标签: