Feed

所属分类:GIS/地图编程
开发工具:Python
文件大小:50KB
下载次数:0
上传日期:2015-05-15 20:35:07
上 传 者sh-1993
说明:  一个简单的应用程序,用于在Python中练习使用RESTful API。基于主题从NPR检索新闻故事,解析...
(A simple app to practice working with RESTful API s in Python. Retrieves news stories from NPR based on topic, parses them for geo-data using Alchemy and OpenStreetMaps, and sends them via e-mail to a specified recipient via SendGrid.)

文件列表:
alchemy_api.py (4089, 2015-05-16)
grab_story.py (2302, 2015-05-16)
mailsender.py (1173, 2015-05-16)
npr_story_api.py (1229, 2015-05-16)
processed_json_examples (0, 2015-05-16)
processed_json_examples\14-10-16_shots: Health News.json (7272, 2015-05-16)
processed_json_examples\14-10-17_shots: Health News.json (7181, 2015-05-16)
processed_json_examples\15-01-05_shots: Health News.json (6768, 2015-05-16)
processed_json_examples\15-05-11_shots: Health News.json (7082, 2015-05-16)
processed_json_examples\2014-07-01_Asia.json (2085, 2015-05-16)
processed_json_examples\2014-07-01_Europe.json (2913, 2015-05-16)
processed_json_examples\2014-07-01_Latin_America.json (3523, 2015-05-16)
processed_json_examples\2014-07-01_Top_Stories.json (6709, 2015-05-16)
raw_json_examples (0, 2015-05-16)
raw_json_examples\Alchemy.json (5372, 2015-05-16)
raw_json_examples\StoryID_1124_2014-06-18_npr.json (82884, 2015-05-16)
raw_json_examples\StoryID_1125_2014-06-18_npr.json (48011, 2015-05-16)
raw_json_examples\StoryID_1126_2014-06-18_npr.json (83305, 2015-05-16)
raw_json_examples\StoryID_1127_2014-06-18_npr.json (27107, 2015-05-16)
requirements.txt (78, 2015-05-16)

Feed.me

A simple Python application created for the purpose of practicing using API's and Git/Github. (No seriously there are 4 different API's being used here...) Uses the NPR The Story API to GET info about NPR stories in the form of Json. Uses the Alchemy Natural Language Processing API to parse location data out of the NPR story text. Uses the OpenStreetMaps nominatim API (hosted on MapQuest's servers) to get geo data (latitude/longitude) from the Alchemy location data. Uses the SendGrid API to send users an e-mail containing the top stories from an NPR category of their choosing.

Instructions: 1. Pip install requirements.txt 2. Open 'mailsender.py' (it's a script) and change the sender, recipient, and categoryID variables to whatever you want. Some sample categoryID's are listed in the comments. A full list can be found at: http://www.npr.org/api/mappingCodes.php 3. Open up 'grab_story.py' if you want to change the parameters for the NPR Story API. The geo\_data variable is set to false because I haven't implemented a mapping function for the geo data quite yet. The defaults are: "def \_\_init\_\_(self, id, numResults=5, npr_story_date=None, startDate=None, endDate=None, include_geo_data=False)" 4. run mailsender.py and the recipient should receive an e-mail with the 5 (or whatever number numResults is set to) most recent stories from the categoryID. Possible Future updates:
-Making a nicer HTML e-mail format.
-Incorporating more news sources.
-Finding creative uses for the geo data. (Including a map of news stories embedded in the e-mail. Possibly using Leaflet.js or Google Maps.)
-Automate how often the e-mails are sent using a Cron script. (http://www.unixgeeks.org/security/newbie/unix/cron-1.html) Other Resources:
Query Generator: http://www.npr.org/api/queryGenerator.php

近期下载者

相关文件


收藏者