tictail api的python绑定

tictail的Python项目详细描述


Tictail蟒蛇[构建状态](https://travis-ci.org/tictail/tictail-python.svg?branch=master)(https://travis ci.org/tictail/tictail python)


tictail api的python绑定([api reference](https://tictail.com/developers/documentation/api reference/)。

r/>$pip install tictail
``

或者,您可以下载[源代码](https://github.com/tictail/tictail-python/releases),然后运行:

``shell
`$python setup.py install
````

mac os x上可能会出现以下错误:


```
clang:error:未知参数:'-mno fused madd'[-wunused command line argument hard error in future]
````

解决方法是设置
archflags环境变量,将此类错误视为警告:

``shell
$archflags=-wno error=unused command line argument hard error in future pip install tictail
````

2.7。python 3.2+支持即将到来。


对bug和f贡献

eature请求,请打开一个[问题](https://github.com/tictail/tictail python/issues)。如果您想为"tictail python"的开发做出贡献(这是一个宏大的事实),那么克隆repo,安装开发依赖项并删除它。请确保包含测试,更新变更日志并将您的姓名添加到贡献者列表中。

\运行"make test"以
运行所有测试。或者,您可以使用"py.test"二进制文件来运行特定的测试。


有关如何执行此操作的详细信息不在本文档的范围内,但文档的[身份验证](https://tictail.com/developers/documentation/authentication/)部分提供了一组很好的说明和最佳实践。

` tictail`client并获取与令牌关联的存储:

``python
from tictail import tictail

client=tictail('<;access\u token>;')
store=client.me()
````

如果您希望
覆盖默认配置,可以为构造函数提供配置
字典:

``python
from tictail import tictail

config={
'timeout:40
}
client=tictail('<;access\token>;',config=config)
`````

see`client.py`了解可以重写的内容的详细信息。


它的子资源在下面进一步介绍。

**从tictail import tictail检索存储**

``python


client=tictail('<;access_token>;')
store=client.me()
````

一个示例(部分)响应:

``python
>;>;打印存储
存储({
"联系人电子邮件":u'thestartupstore@example.com',
"国家":u'se',
"货币":u'sek',
"仪表板URL":u'https://tictail.com/dashboard/s存储/启动存储',
"描述":支持本地启动!"…",
'id''id':u't,
'language':u'en,
'logtype':[…],
'name':u'the startup store,
'sandbox':false,
'storekeeper'电子邮箱:u'johndoe@example.com,
'url'
'url':u'http://thestartuupstore.tictail.com'








参考:[卡片](https://tictail.com/developers/documentation/api reference/card)


cards是您将内容输入商店提要的方式。"card"资源仅允许在此时创建卡。

**网站',
'操作':'http://example.com',
'卡片类型':'media',
'内容':{
'标题':'您不会后悔这一点'
}
}
``````

>示例响应:

``python
>>>打印卡({
'操作':u'http://example.com',
'卡片_类型:u'media,
'content':{
u'header':u'u'u'u'u不会后悔,
},
'创建地点:u'2014-04-23t20:25:47.745085',
'id':u'frex',
'修改地点:u'2014-04-23t20:24:47.752799',
'title':u'u'u'修改地点:u'2014-04-23t20:2014-04-23t20:25:47.752799',
'title':u'u'u'u'u'u'u'查看这个令人惊奇的网站'
>>>
`
`
`<产品

参考:[产品](https://tictail.com/developers/documentation/api reference/product)

使用"产品"资源,您可以列出商店的所有可见产品或按ID获取特定产品。
列出产品接受四个可选查询参数:

-`limit`对于页面大小
-`before`and`after`用于对给定id
-`categories`的产品在产品之前或之后创建的产品进行分页,用于筛选特定类别的产品

**列出在产品id'7bxv'**

``python
tail

client=tictail('<;access_token>;')
store=client.me()
products=store.products.all(在'7bxv'之后,限制=50)
`````

**列出来自tictail import tictail的所有衬衫(id:'avr')和牛仔裤(id:'bet2')**

``python
ken>;')
store=client.me()
products=store.products.all(categories=['avr','bet2'])
```````

**从tictail import tictail检索特定产品**

```python


client=tictail('<;access_token>;')
store=client.me()
product=store.products。获取('7bxv')
```````




````python
>>gt;打印产品
>产品({
'创建地点:u'2014-01-29t13:41:41:43',
'货币:u'印尼国家',
'描述:u',
'id':u'7bxv',
'图像':[],
'修改地点:u'2014-01-29t13:41:43'43',
'图像':[],
'修改地点:u'2014-01-01-29t13:2014-01-29t13-29t13:41:41:43'41:43',
"价格":1200,
‘价格含税’价格:1200,
‘价格含税’:真实,
‘数量’:无,
‘鼻涕虫’:u‘超级杜普勒-tshirt’,
‘状态’:u‘发布’,
‘商店id’:u‘scv’,
‘标题’:u‘超级杜普勒-tshirt’,
‘无限制’:真实,
‘变数’:[[
})
`````


`````

`
//`
` ` ` ` ` ` ` ` ` ` ` ` ` `客户

引用:[customer](https://tictail.com/developers/documentation/api reference/customer)

"customer"资源返回商店的所有客户,即至少从商店购买过一次物品的人。列出客户可以接受三个可选的
查询参数:

-`limit`用于页面大小
-`before`和`after`用于对在具有给定id的客户之前或之后创建的客户进行分页

**从tictail import tictail检索特定客户**

``python
/>
client=tictail('<;access_token>;')
store=client.me()
customer=store.customers.get('7')
``````

**列出所有客户**

```python
ent.me()
customers=store.customers.all()
```


示例响应:

```python
>>gt;打印customer
customer({
'country':u'se',
'创建地点:u'2012-12-10t19:31:07',
'email':u'johndoe@example.com',
'id':u'bz21',
'language':u'en',
'
"modified_at":无,
"name":u'john doe'
})
`````


列表跟随器接受三个可选的查询参数:

-`limit`用于页面大小
-`before`和`after`用于对给定id


**的跟随器的前后创建的跟随器进行分页**

``python
=tictail('<;access_token>;')
store=client.me()
follower=store.followers.create({'email':'newfollower@example.com'})
``````

**从tictail import tictail中删除follower**
``python

client=tictail('<;access_token>;')
store=client.me()

您可以从"集合"中删除跟随者…
deleted=store.followers.delete(7)
assert deleted



``python
从tictail导入tictail

client=tictail('<;access_token>;')
store=client.me()
followers=store.followers.all()
````

**列出在从tictail导入tictail的id为"7an"的跟随器之前创建的所有跟随器**

``python
``python
/>
client=tictail('<;access_token>;')
store=client.me()
followers=store.followers.all(before='7an')
`````

示例响应:

`` python
>>>print follower
followers({
'created_at':u'2013-12-10t19:31:07',
'modified_at':none,
"email":u'johndoe@example.com,
"id":u'nzur'
})
`````


如果您希望获得商店
的客户,请使用"customer"资源。列表订单接受
五个可选查询参数:

-`limit`用于页面大小
-`before`和`after`用于对在给定id的订单之前或之后创建的订单进行分页日期(日期
可以是"iso 8601"格式的字符串,也可以是"datetime"对象)


**列出指定id之后的所有订单**

``python
from tictail import tictail

store=client.me()
orders=store.orders.all(之后='afqx')
```

**列出在日期之后修改的所有订单**

``python
from datetime import datetime
from tictail import tictail

client=tictail('<;access\u token>;')
store=client.me()

s=store.orders.all(modified_after=now)

()消费品包括增值税:真的,
"折扣":[],
"商品":[{
"货币":英国克朗,
"价格":0,






'fullfilment':{
‘状态’:u‘未处理’,



‘价格’:0,
‘id’:u‘afqx’,
‘增值税’:{
‘价格’:0,
‘价格’:u‘0.25万’





`` `,






` ` ` ` ` ` ` ` ` `主题

参考:[主题](https://tictail.com/developers/documentation/api reference/theme)

存储主题。

**从tictail import tictail获取主题**

``python

store=client.me()
theme=store.theme.get()
````


一个示例(部分)响应:

```python
>;>print theme
theme({
'id':u'ag',
'markup':u'<;!doctype html>;\n<;html lang="en">;\n<;head>;\n….'
}
````


它们被实现为经典的父子层次结构,仅限于一个深度级别。

**列出所有类别**

``python
from tictail import tictail

store=client.me()
categories=store.categories.all()
```

一个示例(部分)响应:

`` python
>;>print categories
[
category({
'创建位置:u'2012-05-01t00:47:16',
'id':u'dn',
'修改位置:u'2012-02-13t16:58:40',
'父ID':无,
'位置:0,
'title':u'stickers'
}),
类别({
"创建位置":u'2012-10-29t12:02:09,
"id":u'da,
"修改位置":无,
"父ID":u'dn,
"位置":1,
"标题":u'devawsmbx'
})

]
```

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
带有服务类安卓的java altbeacon   java在OpenXava免费版本中可以创建多个用户吗?   java如何决定定义变量“private”?   java为什么GetMethodID()对不存在的方法不返回NULL?   java Get JComboBox项字符串表示法   java如何在ifs之间设置限制?   java Android错误:IllegalStateException   JavaSpring4MVC语言环境已更改,但JSP对此没有响应   java Netbeans:如何构建。jar文件随附外部文件。jar库?   Spring Petclinic项目Maven编译时出现java错误   声明Java数组增量元素的快速方法   java无法使用相对xpath找到元素   javascript无法更改标题,也无法在操作栏上显示图标   java标签不是一个接一个地动态创建的   java如何使用ThymeLeaf将对象的属性绑定到隐藏字段?   java从EJB无状态会话bean调用CDI会话范围的生产者方法   java为什么num+=array[i]与for循环中的num=num+array[i]的工作方式不同   使用jsonsimple实现jQuery UI自动完成的java JSON格式   JavaFaceletsUI:重复标记中断JSF表单验证