Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. var container = {
  2. Bucket: 'testBucket',
  3. Key: '001',
  4. };
  5.  
  6. exports.handler = function(event, context)
  7. {
  8. s3.getObject(container, function(err, data) {
  9. var zips = JSON.parse(data.Body.toString());
  10.  
  11.  
  12. for (var i = 0; i < zips.zips.length; i++) {
  13. var params = {
  14. host: 'api.openweathermap.org',
  15. path: '/data/2.5/weather/?apikey=mykey&zip=' + zips.zips[i].zip,
  16. method: 'GET'
  17. };
  18. var req = http.request(params, function(res) {
  19. res.on('data', function(data) {
  20. console.log(JSON.parse(data.toString()).coord);
  21. });
  22. });
  23. req.end();
  24. }
  25. });
  26. };
  27.  
  28. 2017-02-21T23:19:04.539Z 229811ef-f88c-11e6-ae5f-419f2e373abe undefined
  29. 2017-02-21T23:19:04.817Z 229811ef-f88c-11e6-ae5f-419f2e373abe { lon: -97.01, lat: 32.71 }
  30. 2017-02-21T23:19:05.102Z 229811ef-f88c-11e6-ae5f-419f2e373abe { lon: -122.39, lat: 37.79 }
  31. 2017-02-21T23:19:05.598Z 229811ef-f88c-11e6-ae5f-419f2e373abe { lon: -122.2, lat: 47.72 }
  32. 2017-02-21T23:19:05.677Z 229811ef-f88c-11e6-ae5f-419f2e373abe { lon: -122.19, lat: 47.68 }
  33.  
  34. 2017-02-21T23:18:41.575Z 14fd6753-f88c-11e6-9329-f35b8d3222e0 undefined
  35. 2017-02-21T23:18:41.585Z 14fd6753-f88c-11e6-9329-f35b8d3222e0 undefined
  36. 2017-02-21T23:18:41.758Z 14fd6753-f88c-11e6-9329-f35b8d3222e0 { lon: -122.09, lat: 37.39 }
  37. 2017-02-21T23:18:41.796Z 14fd6753-f88c-11e6-9329-f35b8d3222e0 { lon: -122.2, lat: 47.72 }
  38. 2017-02-21T23:18:41.802Z 14fd6753-f88c-11e6-9329-f35b8d3222e0 { lon: -97.01, lat: 32.71 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement