MAC vendor lookup: Difference between revisions

Added AppleScript implementation
(Added error message on multiple calls to http://api.macvendors.com/)
(Added AppleScript implementation)
Line 61:
23-45-67 N/A
foobar N/A</pre>
 
=={{header|AppleScript}}==
This is the first implementation to build in a delay between two calls to avoid throttling by macvendors.com. The version below is the as-typed one :
<lang AppleScript>
set {table, macList} to {{return}, {"88:53:2E:67:07:BE", "D4:F4:6F:C9:EF:8D", "FC:FB:FB:01:FA:21", "4c:72:b9:56:fe:bc", "00-14-22-01-23-45"}}
 
repeat with burger in macList
set end of table to do shell script "curl http://api.macvendors.com/" & burger & " && sleep 5 && echo '\n'" & return
end repeat
 
return table as string
</lang>
 
Which will turn into the one below once it is compiled. Script Editor translates \n to a newline in the code itself.
<lang AppleScript>
set {table, macList} to {{return}, {"88:53:2E:67:07:BE", "D4:F4:6F:C9:EF:8D", "FC:FB:FB:01:FA:21", "4c:72:b9:56:fe:bc", "00-14-22-01-23-45"}}
 
repeat with burger in macList
set end of table to do shell script "curl http://api.macvendors.com/" & burger & " && sleep 5 && echo '
'" & return
end repeat
 
return table as string
</lang>
 
{{out}}
<pre>
"
Intel Corporate
Apple, Inc.
Cisco Systems, Inc
PEGATRON CORPORATION
Dell Inc.
"
</pre>
 
=={{header|Arturo}}==
503

edits