def run(self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict[Text, Any]) -> List[Dict[Text, Any]]: dispatcher.utter_message(text='Storing Booking') cuisine = tracker.get_slot('cuisine_slot') numberofpeople = tracker.get_slot('num_people') API_KEY = '3bba5e87-358c-498c-9e19-01ee158fddd0' docid = "hiDjxzDYZT" tabid = "grid-VaHaPUZKkn" columnid = "c-NXfRNP3U0x" #Tipo Comida columnind = "c-FOYgcNlXos" # Número de comensales if hasattr(ssl, '_create_unverified_context'): ssl._create_default_https_context = ssl._create_unverified_context coda = Coda(API_KEY) payload = { 'rows': [ { 'cells': [{ 'column': columnid, 'value': cuisine }, { 'column': columnind, 'value': numberofpeople }], }, ], "keyColumns": [columnid] } coda.upsert_row(docid, tabid, payload) return []
else: ent = len(d.entries) coda = Coda('c5d228f1-a38e-4956-b6e6-f6ceaac089d0') for i in range(0,int(ent)) : try : publicada = d.entries[i].published_parsed publicadodate = date (publicada.tm_year, publicada.tm_mon,publicada.tm_mday) if ( publicadodate > limite) : #print(d.entries[i].title) #print(d.entries[i].description) #print(d.entries[i].link) #print('--------------------------------------------------------------') payload = { 'rows': [ { 'cells': [ {'column': 'c-_zKlSZgEHp', 'value': d.entries[i].title}, {'column': 'c-FaaJIgjDAb', 'value': d.entries[i].link}, {'column': 'c-w6-NqTjAXr', 'value': publicadodate.strftime("%m/%d/%Y")} ], }, ], } coda.upsert_row('G6ody-h41g','grid-30lv9fOPY1',payload) except : pass b = b+1
#print(response.content) # Hacemos el parseo del XML soup = BeautifulSoup(response.content, 'xml') titsoup = soup.find_all('titulo') # Empezamos con la integración con CODA coda = Coda(API_KEY) for i in range(0, len(titsoup)): entries_interesante = "false" entries_title = titsoup[i].text for c in range(0, len(intwords)): if (str(entries_title).lower().find(intwords[c]) >= 0): entries_interesante = "true" payload = { 'rows': [ { 'cells': [{ 'column': titleid, 'value': entries_title }, { 'column': interesanteid, 'value': entries_interesante }], }, ], "keyColumns": [titleid] } coda.upsert_row(docid, tabid, payload)