-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpathbot.py
More file actions
46 lines (34 loc) · 1.41 KB
/
pathbot.py
File metadata and controls
46 lines (34 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from googleapiclient.discovery import build
from google.oauth2 import service_account
import slack
import time
SLACK_TOKEN = "xxxxxxxxx"
client = slack.WebClient(token = SLACK_TOKEN)
SCOPES = ['https://www.googleapis.com/auth/spreadsheets']
SERVICE_ACCOUNT_FILE = 'keys.json'
creds = None
creds = service_account.Credentials.from_service_account_file(
SERVICE_ACCOUNT_FILE, scopes=SCOPES)
SAMPLE_SPREADSHEET_ID = 'xxxxxxxxx'
SAMPLE_RANGE_NAME = 'Form Responses 1!E2:E'
service = build('sheets', 'v4', credentials=creds)
sheet = service.spreadsheets()
#kaldığı yerden devam etmesi için range i ayarla
while True :
result = sheet.values().get(spreadsheetId=SAMPLE_SPREADSHEET_ID,
range=SAMPLE_RANGE_NAME).execute()
liste = []
for i in result["values"]:
liste.append(i)
print(liste)
counter = list(range(0,400,5))
print(counter)
if len(liste) in counter == 0 :
data = liste.count(["Data Science"])
aws = liste.count(["AWS/Devops"])
full = liste.count(["Full Stack"])
cyber = liste.count(["Cyber Security"])
yazi = f"Anketi dolduran kişi sayısı {len(liste)} olmuştur. \n Full Stack = {full} \n Data Science = {data} \n AWS/Devops = {aws} \n Cyber ={cyber}"
client.chat_postMessage(channel="#010_core_team", text = yazi)
print(yazi)
time.sleep(20)