#NEWLINE# @ staticmethod #NEWLINE# def _x_user_parser( user , data ) : #NEWLINE# #INDENT# _user = data . get ( 'query' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'results' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'profile' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# user . id = _user . get ( 'guid' ) #NEWLINE# user . gender = _user . get ( 'gender' ) #NEWLINE# user . nickname = _user . get ( 'nickname' ) #NEWLINE# user . link = _user . get ( 'profileUrl' ) #NEWLINE# emails = _user . get ( 'emails' ) #NEWLINE# if isinstance ( emails , list ) : #NEWLINE# #INDENT# for email in emails : #NEWLINE# #INDENT# if ( 'primary' in list ( email . keys ( ) ) ) : #NEWLINE# #INDENT# user . email = email . get ( 'handle' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( emails , dict ) : #NEWLINE# #INDENT# user . email = emails . get ( 'handle' ) #NEWLINE# #UNINDENT# #UNINDENT# user . picture = _user . get ( 'image' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) . get ( 'imageUrl' ) #NEWLINE# ( user . city , user . country ) = _user . get ( 'location' , ',' ) . split ( ',' ) #NEWLINE# user . city = user . city . strip ( ) #NEWLINE# user . country = user . country . strip ( ) #NEWLINE# _date = _user . get ( 'birthdate' ) #NEWLINE# _year = _user . get ( 'birthYear' ) #NEWLINE# if ( _date and _year ) : #NEWLINE# #INDENT# _full = ( ( _date + '/' ) + _year ) #NEWLINE# try : #NEWLINE# #INDENT# user . birth_date = datetime . datetime . strptime ( _full , '%m/%d/%Y' ) #NEWLINE# #UNINDENT# except : #NEWLINE# #INDENT# user . birth_date = _full #NEWLINE# #UNINDENT# #UNINDENT# return user