def get_connections(self, member_id = None, public_url = None, fields=()): """ Fetches the connections of a user whose id is the given member_id or url is the given public_url If none of the parameters given, the connections of the current user are fetched. @Returns: a list of Profile instances or an empty list if there is no connection. Example urls: * http://api.linkedin.com/v1/people/~/connections (for current user) * http://api.linkedin.com/v1/people/id=12345/connections (fetch with member_id) * http://api.linkedin.com/v1/people/url=http%3A%2F%2Fwww.linkedin.com%2Fin%2Flbeebe/connections (fetch with public_url) """ self._check_tokens() raw_url = "/v1/people/%s/connections" if member_id: raw_url = raw_url % ("id=" + member_id) elif public_url: raw_url = raw_url % ("url=" + self._quote(public_url)) else: raw_url = raw_url % "~" fields = ":(%s)" % ",".join(fields) if len(fields) > 0 else None if fields: raw_url = raw_url + fields response = self._do_normal_query(raw_url) document = minidom.parseString(response) connections = document.getElementsByTagName("person") result = [] for connection in connections: profile = Profile.create(connection, self._debug) if profile is not None: result.append(profile) return result
def get_search(self, parameters, fields=[]): """ Use the People Search API to find LinkedIn profiles using keywords, company, name, or other methods. This returns search results, which are an array of matching member profiles. You can specify the fields you want to see using the field list (:people...) Request URL Structure: http://api.linkedin.com/v1/people-search[:(people:(id,first-name,last-name,headline,connections,positions,picture-url,public-profile-url))]?first-name=[first name]&last-name=[last name] ... To learn more refer to https://developer.linkedin.com/documents/people-search-api . Note that the search API was deprecated a while ago and replaced by the people-search API. The result structure changes slightly because people-search returns the entire response in a new people-search tag. people-search returns a slightly different structure -- search returned.. <people> <person/> <person/> ... <person/> </people> but people_search returns <people-search> <people> <person/> <person/> ... <person/> </people> </people_search> So users will have to update their code to reflect this new structure. """ self._check_tokens() fields = ":(people:(id,first-name,last-name,headline,positions,public-profile-url,picture-url,location:(name)))" response = self._do_normal_query("/v1/people-search" + fields, params=parameters) error = self._parse_error(response) if error: self._error = error #logging.error("Parsing Error") return None # Parse the response and list out all of the Person elements document = minidom.parseString(response) connections = document.getElementsByTagName("person") result = [] for connection in connections: profile = Profile.create(connection, self._debug) if profile is not None: result.append(profile) return result
def get_profile_raw(self, raw_url, params=None): """ Use the profile API of linked in. Just append the raw_url string to the v1/people/ url and the dictionary params as parameters for the GET request """ self._check_tokens() response = self._do_normal_query("/v1/people/" + raw_url, params=params) return Profile.create(minidom.parseString(response), self._debug)
def register(): input_data = request.get_json() from model import Profile if Profile.where(email=input_data['email']).first() is not None: abort(400, {'message': 'EMAIL_ALREADY_EXISTS'}) profile = Profile.create( id=input_data['id'], # Personal details imageUrls=input_data['imageUrls'], name=input_data['name'], email=input_data['email'], password=input_data['password'], gender=input_data['gender'], dob=input_data['dob'], birth_time=input_data['birth_time'], birth_place=input_data['birth_place'], religion=input_data['religion'], caste=input_data['caste'], subcaste=input_data['subcaste'], gothram=input_data['gothram'], star=input_data['star'], qualification=input_data['qualification'], job=input_data['job'], workplace=input_data['workplace'], income=input_data['income'], height=input_data['height'], weight=input_data['weight'], mother_tongue=input_data['mother_tongue'], known_language=input_data['known_language'], nativity=input_data['nativity'], marital_status=input_data['marital_status'], talents=input_data['talents'], hobbies=input_data['hobbies'], vehicle_driving=input_data['vehicle_driving'], disabilities=input_data['disabilities'], # Horoscope details box11=input_data['box11'], box12=input_data['box12'], box13=input_data['box13'], box14=input_data['box14'], box15=input_data['box15'], box16=input_data['box16'], box17=input_data['box17'], box18=input_data['box18'], box19=input_data['box19'], box110=input_data['box110'], box111=input_data['box111'], box112=input_data['box112'], box21=input_data['box21'], box22=input_data['box22'], box23=input_data['box23'], box24=input_data['box24'], box25=input_data['box25'], box26=input_data['box26'], box27=input_data['box27'], box28=input_data['box28'], box29=input_data['box29'], box210=input_data['box210'], box211=input_data['box211'], box212=input_data['box212'], # Family details father_name=input_data['father_name'], father_occupation=input_data['father_occupation'], mother_name=input_data['mother_name'], mother_occupation=input_data['mother_occupation'], contact1=input_data['contact1'], contact2=input_data['contact2'], sibiling_count=input_data['sibiling_count'], family_status=input_data['family_status'], properties=input_data['properties'], anydetails=input_data['anydetails'], # Partner Expectations expected_qualification=input_data['expected_qualification'], expected_place=input_data['expected_place'], expected_income=input_data['expected_income'], expected_caste=input_data['expected_caste'], expected_subcaste=input_data['expected_subcaste'], age_difference=input_data['age_difference'], expected_height=input_data['expected_height'], expected_weight=input_data['expected_weight'], expectations=input_data['expectations']) uuid = str(uuid4()) SESSION[uuid] = profile response_body = { 'session_id': uuid, 'id': profile.id, 'name': profile.name } return jsonify(response_body)