| 154 | Server推送 |
| 155 | ''' |
| 156 | def server(self): |
| 157 | if self.sckey == '': |
| 158 | return |
| 159 | self.diyText() # 构造发送内容 |
| 160 | data = { |
| 161 | "text" : self.title, |
| 162 | "desp" : self.content |
| 163 | } |
| 164 | if self.pushmethod.lower() == 'scturbo': #Server酱 Turbo版 |
| 165 | url = 'https://sctapi.ftqq.com/' + self.sckey + '.send' |
| 166 | response = requests.post(url, data=data, headers = {'Content-type': 'application/x-www-form-urlencoded'}) |
| 167 | errno = response.json()['data']['errno'] |
| 168 | else: #Server酱 普通版 |
| 169 | url = 'https://sct.ftqq.com/' + self.sckey + '.send' |
| 170 | response = requests.post(url, data=data, headers = {'Content-type': 'application/x-www-form-urlencoded'}) |
| 171 | errno = response.json()['errno'] |
| 172 | if errno == 0: |
| 173 | self.log('用户:' + self.name + ' Server酱推送成功') |
| 174 | else: |
| 175 | self.log('用户:' + self.name + ' Server酱推送失败,请检查sckey是否正确') |
| 176 | |
| 177 | ''' |
| 178 | 自定义要推送到微信的内容 |