Pli*_*ken 2 post python-3.x slack
我正在写一个脚本,读取两个CSV文件之间的差异.一旦它被读出,我应该使用WebHook联系一个松弛的页面与比较的结果.我在发送Post方法时遇到了困难.
slack提供的链接产生400的响应,使用/ post或:8080,最后得到200,但松弛页面中没有弹出任何内容.
有什么想法或建议吗?
def main():
csvDiff()
#print(l)
post()
def csvDiff():
f = open("new.csv")
csv_f = csv.reader(f)
old=set(pd.read_csv("old.csv", index_col=False, header=None)[0]) #reads the csv, takes only the first column and creates a set out of it.
new=set(pd.read_csv("new.csv", index_col=False, header=None)[0]) #same here
diff = new - old
#Convert the diff set into a list
diff=list(diff)
#print(diff)
#print(newConnections)
for row in csv_f:
if row[0] in diff:
l.append(row)
def makeCsv():
l = pd.to_csv
def post():
url = 'whatever'
payload={"text": "A very important thing has occurred! <https://alert-system.com/alerts/1234|Click here> for details!"}
r = requests.post(url, data=json.dumps(l).encode('utf8'))
print(r)
if __name__ == "__main__":
main()
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2169 次 |
| 最近记录: |