コード例 #1
0
ファイル: angel_list.py プロジェクト: sbberg1/python-programs
def funding( startup ):
	if startup.get( "last_round" ) is None:
		al_data = startup[ 'al_data' ]
		al_id = property( al_data, 'id' )
		al_funding = bot_utils.load_json( "https://api.angel.co/1/startups/%s/funding?access_token=%s" % (al_id, access_token) )
		if al_funding is not None:
			funding_info = al_funding.get( "funding" )
			total_raised = 0
			last_round = None

			for funding in funding_info:
				amount = property( funding, "amount" )

				if amount is not None:					
					closed = property( funding, "closed_at" )
				
					total_raised = total_raised + amount
					if last_round is None or closed > last_round.get( "closed_at" ):
						last_round = funding

			if last_round is not None:
				bot_utils.set_if_empty( startup, "last_round", last_round.get( "amount" ) )
				bot_utils.set_if_empty( startup, "last_round_type", last_round.get( "round_type" ) )
				bot_utils.set_if_empty( startup, "last_round_url", last_round.get( "source_url" ) )
				bot_utils.set_if_empty( startup, "total_funding", total_raised )
コード例 #2
0
ファイル: angel_list.py プロジェクト: RK905/vcbot
def funding(startup):
    if startup.get("last_round") is None:
        al_data = startup['al_data']
        al_id = property(al_data, 'id')
        al_funding = bot_utils.load_json(
            "https://api.angel.co/1/startups/%s/funding" % al_id)
        if al_funding is not None:
            funding_info = al_funding.get("funding")
            total_raised = 0
            last_round = None

            for funding in funding_info:
                amount = property(funding, "amount")

                if amount is not None:
                    closed = property(funding, "closed_at")

                    total_raised = total_raised + amount
                    if last_round is None or closed > last_round.get(
                            "closed_at"):
                        last_round = funding

            if last_round is not None:
                bot_utils.set_if_empty(startup, "last_round",
                                       last_round.get("amount"))
                bot_utils.set_if_empty(startup, "last_round_type",
                                       last_round.get("round_type"))
                bot_utils.set_if_empty(startup, "last_round_url",
                                       last_round.get("source_url"))
                bot_utils.set_if_empty(startup, "total_funding", total_raised)
コード例 #3
0
ファイル: angel_list.py プロジェクト: sbberg1/python-programs
def create( al_data ):
	startup = {}
	startup[ "al_data" ] = al_data
	startup[ "name" ] = property( al_data, "name" )
	startup[ "short_description" ] = property( al_data, "high_concept" )
	startup[ "description" ] = property( al_data, "product_desc" )
	startup[ "url" ] = property( al_data, "company_url" )
	startup[ "angel_list_url" ] = property( al_data, "angellist_url" )
	startup[ "location" ] = location( al_data )
	startup[ "tags" ] = tags( al_data )
	startup[ "quality" ] = property( al_data, "quality" )

	updated = property( al_data, "updated_at" )
	bot_utils.set_if_empty( startup, "updated",  
		datetime.datetime.strptime( updated, '%Y-%m-%dT%H:%M:%SZ').replace(hour=0, minute=0, second=0, microsecond=0 ) )

	funding( startup )

	return startup
コード例 #4
0
ファイル: angel_list.py プロジェクト: RK905/vcbot
def create(al_data):
    startup = {}
    startup["al_data"] = al_data
    startup["name"] = property(al_data, "name")
    startup["short_description"] = property(al_data, "high_concept")
    startup["description"] = property(al_data, "product_desc")
    startup["url"] = property(al_data, "company_url")
    startup["angel_list_url"] = property(al_data, "angellist_url")
    startup["location"] = location(al_data)
    startup["tags"] = tags(al_data)
    startup["quality"] = property(al_data, "quality")

    updated = property(al_data, "updated_at")
    bot_utils.set_if_empty(
        startup, "updated",
        datetime.datetime.strptime(updated, '%Y-%m-%dT%H:%M:%SZ').replace(
            hour=0, minute=0, second=0, microsecond=0))

    funding(startup)

    return startup
コード例 #5
0
def last_round( startup ):
	if startup.get( "last_round" ) is None:
		rounds = relationship( startup, "funding_rounds" ) 
		if rounds is not None:
			round = rounds[0]
			url = authenticate( "http://api.crunchbase.com/v/2/" + round.get( "path" ) )
			last_round_data = bot_utils.load_json( url )
			startup[ "cb_last_round" ] = last_round_data
			bot_utils.set_if_empty( startup, "last_round", property( startup, "money_raised_usd", "cb_last_round" ) )
			bot_utils.set_if_empty( startup, "last_round_type", property( startup, "funding_type", "cb_last_round" ) )
			bot_utils.set_if_empty( startup, "last_round_url", funding_web + property( startup, "permalink", "cb_last_round" ) )
コード例 #6
0
def fill( startup, cb_data, name ):
	if startup.get( "cb_data" ) is None:
		startup[ "cb_data" ] = cb_data
		bot_utils.set_if_empty( startup, "name", property( startup, "name" ) )
		bot_utils.set_if_empty( startup, "short_description", property( startup, "short_description" ) )
		bot_utils.set_if_empty( startup, "description", property( startup, "description" ) )
		bot_utils.set_if_empty( startup, "url", property( startup, "homepage_url" ) )
		startup[ "crunchbase_url" ] = base_web + "organization/" + name.lower().replace( " ", "-" ).replace( ".", "-")
		bot_utils.set_if_empty( startup, "location", location( startup )  )
		bot_utils.append_values( startup, "tags", tags( startup ) )
		bot_utils.set_if_empty( startup, "total_funding", property( startup, "total_funding_usd" ) )
		updated = property( startup, "updated_at" )
		updated = bot_utils.create_date( updated )
		bot_utils.set_if_empty( startup, "updated",  updated )
		last_round( startup )

	return startup