def get_jsapi_card_ticket(self):
jsapi_card_ticket_key = '<STR_LIT>'.format(self.appid)<EOL>jsapi_card_ticket_expire_at_key = '<STR_LIT>'.format(self.appid)<EOL>ticket = self.session.get(jsapi_card_ticket_key)<EOL>expires_at = self.session.get(jsapi_card_ticket_expire_at_key, <NUM_LIT:0>)<EOL>if not ticket or int(expires_at) < int(time.time()):<EOL><INDENT>ticket_response = self.get_ticket('<STR_LIT>')<EOL>ticket = ticket_response['<STR_LIT>']<EOL>expires_at = int(time.time()) + int(ticket_response['<STR_LIT>'])<EOL>self.session.set(jsapi_card_ticket_key, ticket)<EOL>self.session.set(jsapi_card_ticket_expire_at_key, expires_at)<EOL><DEDENT>return ticket<EOL>
获取 api_ticket：是用于调用微信卡券JS API的临时票据，有效期为7200 秒，通过access_token 来获取。
微信文档地址：http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
该方法会通过 session 对象自动缓存管理 ticket

:return: ticket