Ejemplo n.º 1
0
 def __init__(self):
     Scraper.__init__(self)
     api_key = self.config["youtube"]["api_key"]
     self.url = "https://www.googleapis.com/youtube/v3/search"
     self.params = {
         "order": "date",
         "maxResults": 10,
         "channelId": "UCH1dpzjCEiGAt8CXkryhkZg",
         "key": api_key,
         "type": "upload",
         "part": "snippet"
     }
     self.details = Bernie2016VideoDetailScraper()
     self.video_provider = VideoProvider()
     self.push_provider = PushProvider()
Ejemplo n.º 2
0
 def __init__(self):
     Scraper.__init__(self)
     c = self.config["bsd"]
     self.html = HTMLParser()
     self.call_path = "/page/api/event/search_events"
     self.params = {
         "api_ver": "2",
         "api_id": c["api_id"],
         "api_ts": str(int(time.time()))
     }
     self.signed_params = self.sign_params(c["api_secret"])
     self.url = "".join(
         [c["endpoint"], self.call_path, "?", self.signed_params])
     self.map = {"event_id": "original_id", "start_dt": "start_time"}
     self.event_provider = EventProvider()
     self.push_provider = PushProvider()
Ejemplo n.º 3
0
 def __init__(self, url):
     Scraper.__init__(self)
     self.url = url
     self.html = HTMLParser()
     self.issue_provider = IssueProvider()
     self.push_provider = PushProvider()
Ejemplo n.º 4
0
 def __init__(self):
     Scraper.__init__(self)
     self.url = "https://berniesanders.com/daily/"
     self.html = HTMLParser()
     self.article_provider = ArticleProvider()
     self.push_provider = PushProvider()
Ejemplo n.º 5
0
@app.route('/issue/<uuid:issue_uuid>', methods=['GET', 'POST'])
@auth.login_required
def issue_detail(issue_uuid):
    issue = issue_provider.read(issue_uuid)
    updated = False
    if request.method == 'POST' and issue_provider.update(issue, request):
        updated = True
    return render_template('issue.html', issue=issue, updated=updated)


if __name__ == '__main__':
    try:
        with open('/opt/bernie/config.yml', 'r') as f:
            conf = yaml.load(f)['flask']
    except IOError:
        msg = "Could not open config file: {0}"
        logging.info(msg.format(self.configfile))
        raise
    else:
        event_provider = EventProvider()
        issue_provider = IssueProvider()
        video_provider = VideoProvider()
        article_provider = ArticleProvider()
        news_provider = NewsProvider()
        push_provider = PushProvider()
        users = {conf['httpauth_username']: conf['httpauth_password']}
        app.run(host=conf['host'], debug=conf['debug'])
        register(conf['parse_application_id'], conf['parse_rest_api_key'],
                 conf['parse_master_key'])
        #Push.message("Good morning", channels=["Mike Testing"])
Ejemplo n.º 6
0
 def __init__(self, url):
     Scraper.__init__(self)
     self.url = url
     self.html = HTMLParser()
     self.news_provider = NewsProvider()
     self.push_provider = PushProvider()