2
我正在編寫一個讀取兩個CSV文件之間差異的腳本。一旦它被讀出,我應該使用一個WebHook來聯繫一個鬆弛的頁面和比較結果。我很難發送Post方法。Python中的發佈請求到Slack
由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()
,對於純文本的工作,我怎麼會去發送列表? 你也可以告訴我我要去哪裏嗎?非常感謝 我希望發送下列存儲在列表中的數據。任何建議在郵寄中發送它? [['88.88.88','aaaaaaa','[Unknown]','','0','[Unknown]','','','','','','']] ,['77 .77.77.77','bbbbbbbbb','[未知]','','0','[未知]','','','','','','']]] – Plisken