Ejemplo n.º 1
0
 def get_data(self):
     """Returns the data of the user"""
     if self.user_type is 'Me':
         data = r.get('/profile')
         return data
     else:
         data = r.get('/user/{}'.format(self.id))
     if 'error' in data:
         print('Error user was not found')
     return data['results']
Ejemplo n.º 2
0
 def yield_users(self):
     """Returns a generator of nearby users as NormalUser()"""
     while True:
         resp = r.get('/user/recs')
         recs = resp['results'] if 'results' in resp else []
         for rec in recs:
             yield u.UserController(rec['_id']).get_user()
Ejemplo n.º 3
0
 def yield_usersv2(self):
     """Returns a generator of nearby users as NormalUser() and calculates location"""
     while True:
         resp = r.get('/v2/recs/core?locale=en-US')
         recs = resp['data']['results'] if 'data' in resp else []
         for rec in recs:
             if rec['type'] == 'user':
                 yield u.UserController(rec['user']['_id']).get_user()
Ejemplo n.º 4
0
 def __init__(self):
     self.id = self.get_id()
     self.data = r.get('/profile')
     self.meta = r.get('/meta')
     self.metav2 = r.get('/v2/meta')
Ejemplo n.º 5
0
 def me(self):
     """Returns a UserModel() for the Session"""
     return u.UserController(r.get('/profile')['_id']).get_user()
Ejemplo n.º 6
0
 def get_id(self):
     """Returns the _id of the Session"""
     return r.get('/profile')['_id']
Ejemplo n.º 7
0
 def fast_match_count(self):
     """Returns the number of like's the session user has received"""
     return r.get('/v2/fast-match/count')['data']['count']
Ejemplo n.º 8
0
 def search_gifs(self, query, limit=3):
     """Returns the limit=int(amount) of gifs based on the query -> see giphy docs"""
     return r.get('/giphy/search?limit={}&query={}'.format(limit, query))
Ejemplo n.º 9
0
 def trending_gifs(self, limit=3):
     """Returns the trending gifs based on limit=int(amount)"""
     return r.get('/giphy/trending?limit={}'.format(limit))
Ejemplo n.º 10
0
 def like(self):
     """Likes (swipes right) the user"""
     resp = r.get('/like/{}'.format(self.id))
     return resp['match']
Ejemplo n.º 11
0
 def dislike(self):
     """Dislikes (swipes left) the user"""
     resp = r.get('/pass/{}'.format(self.id))
     return resp
Ejemplo n.º 12
0
 def super_like(self):
     """Super likes (swipes up) the user"""
     resp = r.get('/like/{}/super'.format(self.id), {})
     return resp