예제 #1
0
 def getTemplateID(self, MID):
     url = self._getTemplateIdUrl
     if int(MID) < 10:
         MID = "0" + MID
     data = """{
         "template_id_short": "TM000%s",
     }""" % (MID)
     return JsonRespone(url, data)
예제 #2
0
 def getMediaIdList(self, type, offset, count):
     url = self._listUrl
     data = """{
         "type": "%s", 
         "offset": %d, 
         "count" : %d
     }""" % (type, offset, count)
     return JsonRespone(url, data)
예제 #3
0
 def sendTemplateMessage(self, openID, templateID, templateUrl, data):
     url = self._sendTemplateMessageUrl
     data = """ {
        "touser":"******",
        "template_id":"%s",
        "url":"%s",            
        "data":%s
     }""" % (openID, templateID, templateUrl, data)
     return JsonRespone(url, data)
예제 #4
0
 def sendTextMessage(self,openID,context):
     url = self._messageUrl
     data = """{
         "touser": "******", 
         "msgtype": "text", 
         "text": {
             "content": "%s"
         }
     }"""%(openID,context)
     return JsonRespone(url,data)
예제 #5
0
 def sendImageMessage(self,openID,mediaID):
     url = self._messageUrl
     data = """{
         "touser": "******", 
         "msgtype": "image", 
         "image": {
             "media_id": "%s"
         }
     }"""%(openID,mediaID)
     return JsonRespone(url,data)
예제 #6
0
 def sendSingleArticlesMessage(self,openID,articles):
     url = self._messageUrl
     data = """{
         "touser":"******",
         "msgtype":"news",
         "news":{
             "articles": [
              {
                  "title":"%s",
                  "description":"%s",
                  "url":"%s",
                  "picurl":"%s"
              }
              ]
         }
     }"""%(openID,
             articles['title'],
             articles['description'],
             articles['url'],
             articles['picurl'],
         )
     return JsonRespone(url,data)
예제 #7
0
 def getTemplateList(self, templateID):
     url = self._getTemplateListUrl
     data = ""
     return JsonRespone(url, data)
예제 #8
0
 def _get_access_token(self):
     url = self._get_access_token_url
     data = ""
     return JsonRespone(url, data)['access_token']