Example #1
0
for i in range(2):
    end_date = date_1 + datetime.timedelta(days=i)
    try:
        temperature = temp.select_one("tr:nth-of-type(" + str(i + 1) +
                                      ")").select_one("td:nth-of-type(2)").text
        weather_details[end_date.strftime("%d-%b-%Y")] = [temperature]
        weather_details[end_date.strftime("%d-%b-%Y")].append(
            temp.select_one("tr:nth-of-type(" + str(i + 1) +
                            ")").select_one("td:nth-of-type(3)").text)
        weather_details[end_date.strftime("%d-%b-%Y")].append(
            temp.select_one("tr:nth-of-type(" + str(i + 1) +
                            ")").select_one("td:nth-of-type(4)").text)
    except AttributeError:
        print(
            'Weather Forecast NOT AVAILABLE for this Location. Please Enter a popular location.'
        )
        sys.exit(8)

#This Part of code is used to show a desktop notification. It only shows the current day weather for the choosen location.
notif = 'Today\'s Weather Update - ' + area.title(
) + '\nMin/Max Temp: {}\nWeather: {}\nFeels Like: {}'.format(
    weather_details[curr_date][0], weather_details[curr_date][1],
    weather_details[curr_date][2])

#Desktop Notification
#Bt.balloon_tip(notif)

#Slack Notification
Slack.slack_message(notif, __file__)
print(notif)
    if data[-1][0] == today:
        data[-1][1] = str(
            max(int(data[-1][1].replace(',', '')),
                int(total_cases.replace(',', ''))))
        data[-1][2] = str(
            max(int(data[-1][2].replace(',', '')), int(deaths.replace(',',
                                                                      ''))))
        #print(f'{data}')
        with open(filename, 'w') as f:
            wr = csv.writer(f, delimiter=',', lineterminator='\n')
            for item in data:
                wr.writerow(item)
    else:
        with open(filename, 'a') as f:
            writer = csv.writer(f, delimiter=',', lineterminator='\n')
            writer.writerow([
                today,
                int(total_cases.replace(',', '')),
                int(deaths.replace(',', ''))
            ])

msg = f'{country} {total_cases}\tDeaths: {deaths}\n\n{india[0]}\tCases: {india[1]}({india[2]})\tDeaths: {india[3]}'
Slack.slack_message(msg, __file__)
print(f'{india[0]} --> Cases: {india[1]}({india[2]})\tDeaths: {india[3]}')

ch = input(
    '\n\nDo you want to know India\'s COVID-19 State wise Information ?(y/n): \n'
)
if ch.lower() == 'y':
    import COVID19_India_Information as COVID_Ind
Example #3
0
                elif time in ('Just', 'Today'):
                    #Adding to the table row
                    table.add_row([job_name, company, job_url, time_period])

                    #Writing to CSV File
                    writer.writerow([job_name, company, location.title(), job_url, time_period])
                
                elif int(time) <= 29:
                    #Adding to the table row
                    table.add_row([job_name, company, job_url, time_period])

                    #Writing to CSV File
                    writer.writerow([job_name, company, location.title(), job_url, time_period])

except Exception as e:
    print(f'EXCEPTION: {e}')

else:
    '''    
    #Printing the final Table
    print('\n********** Job Details for \'{}\' at \'{}\' ***********'.format(skill.title(), place.title()))
    print(table)
    '''
    try:
        print('\nData Written to \'{}\' Successfully.\nFile Location: {}'.format(file_name, file_path))
        Slack.slack_message(('\nData Written to \'{}\' Successfully.'.format(file_name)))
    except Exception as e:
        print(f'EXCEPTION - SLACK MODULE: {e}')