Home > other >  Python markdown pictures
Python markdown pictures

Time:10-01

The import json
The import urllib. Request
The import time
Import a datetime
The import OS
The import requests
The import base64
Now=datetime. Datetime. Now ()
Y - now_str=now. Strftime (' % % m - H: % d % % m: % S ')

# 1, build the url
Url="https://oapi.dingtalk.com/robot/send? Access_token="# url for robot webhook

# 2, build the request header
The header={
"The content-type" : "application/json,"
"Charset" : "utf-8"
}
# # the first data report
# 3, build request data
Data={
https://bbs.csdn.net/topics/"Msgtype" : "markdown,"
"Markdown" : {
"Title" : ", "
"Text", "! [screenshot] (http://* * * * * * * * * * * */123. The PNG)
"},
"At" : {

"IsAtAll" : True
}
}

# 4, the request to the json data encapsulation
SendData publishes the event=https://bbs.csdn.net/topics/json.dumps (data) encode (" utf-8 ") # dictionary type data can be converted to json format
# 5, send the request
Request=urllib. Request. The request (url=url, data=https://bbs.csdn.net/topics/sendData, headers=headers)
# request=requests. Post (url=url, data=https://bbs.csdn.net/topics/sendData, headers=headers)
# 6, will request to send back data to construct file format
Opener=urllib. Request. Urlopen (request)
# 7, print the results returned
Print (opener. The read ())

I put the network address of the original image after replacement or delete, or from the python as early as the picture?
  • Related