This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import csv | |
import datetime | |
import pytz | |
tzone = 'US/Eastern' | |
def write_CSV(row_array, filename): | |
with open(filename + '.csv', 'w') as csvfile: | |
filewriter = csv.writer(csvfile, quoting=csv.QUOTE_ALL) | |
filewriter.writerow(['Vehicle', 'Date', 'State', 'Distance (miles)', 'Toll Distance (miles)']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Attribute VB_Name = "Module1" | |
Function isDriverActive(grpId As String, drvId As String, api_key As String) As Boolean | |
Dim URL As String, JsonString As String, objHTTP As Object, stMs As String, edMs As String, timeNow As Double | |
timeNow = DateDiff("s", #1/1/1970#, Now()) | |
edMs = Str(timeNow * 1000) | |
stMs = Str((timeNow * 1000) - 691200000) | |
Set objHTTP = CreateObject("WinHttp.WinHttpRequest.5.1") | |
URL = "https://api.samsara.com/v1/fleet/drivers/" & drvId & "?access_token=" & api_key | |
objHTTP.Open "GET", URL, False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import csv | |
import datetime | |
# create CSV file from array or arrays. array structure = [["Sender Type", "Sender Name", "Sent Time", "Message Text", "Read"]] | |
def write_CSV(row_array, filename): | |
with open(filename + '.csv', 'w') as csvfile: | |
filewriter = csv.writer(csvfile, delimiter=',', quotechar='|', quoting=csv.QUOTE_MINIMAL) | |
filewriter.writerow(["Sender Type", "Sender Name", "Sent Time", "Message Text", "Read"]) | |
for row in row_array: |