コード例 #1
0
ファイル: welcome.py プロジェクト: johndpope/insiderr-app
    def _linkedin_login_completed(self, *largs):
        user_profile = largs[1] if len(largs) >1 else None
        if user_profile:
            from config import linkedin_ds
            industry = user_profile.get('industry','unknown')
            expertise = 'unknown'
            if user_profile.get('skills',None):
                try:
                    skills = user_profile.get('skills').get('values', None)
                    expertise = skills[0]['skill']['name']
                except:
                    print 'Error parsing linkedin skills -- %s' % user_profile

            company = 'unknown'
            position = 'unknown'
            if user_profile.get('threeCurrentPositions',None):
                try:
                    positions = user_profile.get('threeCurrentPositions').get('values', None)
                    company = positions[0]['company']['name']
                    position = positions[0]['title']
                except:
                    print 'Error parsing linkedin company/position -- %s' % user_profile

            def update(ds):
                ds.update({
                    'anonymous': anonymous_nick,
                    'industry': industry,
                    'company': company,
                    'position': position,
                    'expertise': expertise
                })
            linkedin_ds.update(update)
        self.dispatch('on_complete')
コード例 #2
0
ファイル: linkedin.py プロジェクト: johndpope/insiderr-app
    def process_user_profile(self, user_profile):
        if user_profile:
            industry = user_profile.get('industry', 'unknown')
            skills = []
            if user_profile.get('skills', None):
                try:
                    linkedin_skills = user_profile.get('skills').get(
                        'values', None)
                    for s in linkedin_skills:
                        skills.append(s['skill']['name'])
                except:
                    print 'Error parsing linkedin skills -- %s' % user_profile

            if len(skills) < 1:
                skills = ['unknown']
            companies = []
            positions = []
            if user_profile.get('positions', None):
                try:
                    linkedin_positions = user_profile.get('positions').get(
                        'values', None)
                    for p in linkedin_positions:
                        ##if not p.get('endDate', None):
                        companies.append(p['company']['name'])
                        positions.append(p['title'])
                except:
                    print 'Error parsing linkedin company/position -- %s' % user_profile

            if len(companies) < 1:
                companies = ['unknown']
            if len(positions) < 1:
                positions = ['unknown']

            def update(ds):
                linkedin_profile = {
                    'anonymous': anonymous_nick,
                    'industry': industry,
                    'company': companies[0],
                    'company_options': companies,
                    'position': positions[0],
                    'position_options': positions,
                    'expertise_options': skills,
                    'expertise': skills[0]
                }
                print 'linkedin PROFILE: %s' % str(linkedin_profile)
                ds.update(linkedin_profile)

            linkedin_ds.update(update)
            return True
        return False
コード例 #3
0
ファイル: linkedin.py プロジェクト: insiderr/insiderr-app
    def process_user_profile(self, user_profile):
        if user_profile:
            industry = user_profile.get('industry','unknown')
            skills = []
            if user_profile.get('skills', None):
                try:
                    linkedin_skills = user_profile.get('skills').get('values', None)
                    for s in linkedin_skills:
                        skills.append( s['skill']['name'] )
                except:
                    print 'Error parsing linkedin skills -- %s' % user_profile

            if len(skills) < 1:
                skills = ['unknown']
            companies = []
            positions = []
            if user_profile.get('positions', None):
                try:
                    linkedin_positions = user_profile.get('positions').get('values', None)
                    for p in linkedin_positions:
                        ##if not p.get('endDate', None):
                        companies.append(p['company']['name'])
                        positions.append(p['title'])
                except:
                    print 'Error parsing linkedin company/position -- %s' % user_profile

            if len(companies) < 1:
                companies = ['unknown']
            if len(positions) < 1:
                positions = ['unknown']

            def update(ds):
                linkedin_profile = {
                    'anonymous': anonymous_nick,
                    'industry': industry,
                    'company': companies[0],
                    'company_options': companies,
                    'position': positions[0],
                    'position_options': positions,
                    'expertise_options': skills,
                    'expertise': skills[0]
                }
                print 'linkedin PROFILE: %s' % str(linkedin_profile)
                ds.update(linkedin_profile)
            linkedin_ds.update(update)
            return True
        return False