<commit_before>import os, sys
import logging
from urlparse import urlparse
from csv import DictReader, Sniffer
from itertools import groupby
from operator import itemgetter
from StringIO import StringIO
from requests import get
from datetime import datetime
import requests
from feeds import extract_feed_links, get_first_working_feed_link
import feedparser
from urllib2 import HTTPError
from app import db, app, Project, Organization, Story, Event
from urlparse import urlparse
from re import match

# Production
gdocs_url = 'https://docs.google.com/a/codeforamerica.org/spreadsheet/ccc?key=0ArHmv-6U1drqdGNCLWV5Q0d5YmllUzE5WGlUY3hhT2c&output=csv'

# Testing
# gdocs_url = "https://docs.google.com/spreadsheet/pub?key=0ArHmv-6U1drqdEVkTUtZNVlYRE5ndERLLTFDb2RqQlE&output=csv"


if 'GITHUB_TOKEN' in os.environ:
    github_auth = (os.environ['GITHUB_TOKEN'], '')
else:
    github_auth = None

if 'MEETUP_KEY' in os.environ:
    meetup_key = (os.environ['MEETUP_KEY'], '')
else:
    meetup_key = None

def get_github_api(url):
    '''
        Make authenticated GitHub requests.
    '''
    logging.info('Asking Github for ' + url)

    got = get(url, auth=github_auth)

    return got

def format_date(time_in_milliseconds):
    '''
        Create a datetime object from a time in milliseconds from the epoch
    '''
    return datetime.fromtimestamp(time_in_milliseconds/1000.0)

def format_location(venue):
    address = venue['address_1']
    if('address_2' in venue.keys() and venue['address_2'] != ''):
        address = address + ', ' + venue['address_2']

    return "{address}, {city}, {state}, {country}".format(address=address,
                city=venue['city'], state=venue['state'], country=venue['country'])

def get_meetup_events(organization, group_urlname):
    '''
        Get events associated with a group
    '''
    meetup_url = "https://api.meetup.com/2/events?status=past,upcoming&format=json&group_urlname={0}&sig_id={1}".format(group_urlname, meetup_key)
    got = get(meetup_url)<commit_msg>Fixed meetup_key and meetup api call.<commit_after>import os, sys
import logging
from urlparse import urlparse
from csv import DictReader, Sniffer
from itertools import groupby
from operator import itemgetter
from StringIO import StringIO
from requests import get
from datetime import datetime
import requests
from feeds import extract_feed_links, get_first_working_feed_link
import feedparser
from urllib2 import HTTPError
from app import db, app, Project, Organization, Story, Event
from urlparse import urlparse
from re import match

# Production
gdocs_url = 'https://docs.google.com/a/codeforamerica.org/spreadsheet/ccc?key=0ArHmv-6U1drqdGNCLWV5Q0d5YmllUzE5WGlUY3hhT2c&output=csv'

# Testing
# gdocs_url = "https://docs.google.com/spreadsheet/pub?key=0ArHmv-6U1drqdEVkTUtZNVlYRE5ndERLLTFDb2RqQlE&output=csv"


if 'GITHUB_TOKEN' in os.environ:
    github_auth = (os.environ['GITHUB_TOKEN'], '')
else:
    github_auth = None

if 'MEETUP_KEY' in os.environ:
    meetup_key = os.environ['MEETUP_KEY']
else:
    meetup_key = None

def get_github_api(url):
    '''
        Make authenticated GitHub requests.
    '''
    logging.info('Asking Github for ' + url)

    got = get(url, auth=github_auth)

    return got

def format_date(time_in_milliseconds):
    '''
        Create a datetime object from a time in milliseconds from the epoch
    '''
    return datetime.fromtimestamp(time_in_milliseconds/1000.0)

def format_location(venue):
    address = venue['address_1']
    if('address_2' in venue.keys() and venue['address_2'] != ''):
        address = address + ', ' + venue['address_2']

    return "{address}, {city}, {state}, {country}".format(address=address,
                city=venue['city'], state=venue['state'], country=venue['country'])

def get_meetup_events(organization, group_urlname):
    '''
        Get events associated with a group
    '''
    meetup_url = "https://api.meetup.com/2/events?status=past,upcoming&format=json&group_urlname={0}&key={1}".format(group_urlname, meetup_key)
    got = get(meetup_url)
{'fraction_non_alphanumeric': 0.11015065448258829, 'fraction_numerical': 0.013336626327488268, 'mean_word_length': 4.688202247191011, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6666419', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1350, 'n_words': 310}