Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

tinder_api/utils/config.py
*.py
example.py
*.pyc
tinder_api/utils/config.py
tinder_api/utils/config.py
tinder_api/utils/config.py
example.py
27 changes: 8 additions & 19 deletions example.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
import tinder_api.session
import itertools
from datetime import datetime
sess = tinder_api.session.Session() # inits the session

print("My _id is %s" %sess.get_id())

#sess.update_profile(bio="VIM is the best")

for user in itertools.islice(sess.yield_users(), 10):
print(user.name) # prints the name of the user see __init__
# How to check if it exists, if it doesnt, it returns <MisssingValue>
if user.bio is not "<MissingValue>":
print(user.bio)
print(user.like()) # returns false if not a match

for match in sess.yield_matches():
print(match.name)
print(match.match_data) # prints all the match_data
print([x.body for x in match.get_messages()]) # gets the body of messages
#print(match.message("Hello")) # sends hello to the match
sess = tinder_api.session.Session() # creates a session

print(sess.meta) # prints your meta data
# sess.update_profile(bio="I love VIM") # updates your bio - see kwargs

for user in sess.yield_users():
print(user.name)
print(user.id)
print(user.age)
print(user.bio)
33 changes: 11 additions & 22 deletions tinder_api/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ def report(self, cause, text=''):
1 : 'spam'
4 : 'inappropriate photos'
"""
resp = r.post('/report/{}'.format(uid),
return r.post('/report/{}'.format(uid),
{"cause": cause, "text": text})
return resp

class NormalUser(UserModel):
def __init__(self, uid, name, bio, age, birth_date, photos, gender,
Expand Down Expand Up @@ -92,14 +91,8 @@ def __init__(self, data, uid, name):
self.data = data
self.sent = dateutil.parser.parse(data['sent_date'])
self.body = data['message']
if data['from'] == uid:
self.sender = name
else:
self.sender = "Me"
if data['to'] == uid:
self.to = name
else:
self.to = "Me"
self.sender = name if data['from'] == uid else "Me"
self.to = name if data['to'] == uid else "Me"

def like_message(self):
"""Likes a message"""
Expand All @@ -118,10 +111,7 @@ def unlike_message(self):
def is_liked(self):
"""Returns True if the messages is liked, otherwise False"""
liked_messages = [x['message_id'] for x in session.Session().get_updates()['liked_messages']]
for mess_id in liked_messages:
if mess_id == self.message_id:
return True
return False
return self.message_id in liked_messages

def __unicode__(self):
return self.body
Expand All @@ -144,7 +134,7 @@ def __init__(self, uid):

def get_data(self):
"""Returns the data of the user"""
if self.user_type is 'Me':
if self.user_type == 'Me':
data = r.get('/profile')
return data
else:
Expand Down Expand Up @@ -180,15 +170,15 @@ def get_user(self):
ping_time = self.const.ping_time
top_song = self._decode_theme_song()
instagram_photos = [photo.image for photo in self.const.instagram.photos]
if self.user_type is 'Normal':
if self.user_type == 'Normal':
return NormalUser(self.id, name, bio, age, birth_date, photos, gender,
distance, job_name, job_title, school_name, school_id,
ping_time, top_song, instagram_photos)
elif self.user_type is 'Match':
elif self.user_type == 'Match':
return MatchUser(self.id, self.match_id, name, bio, age, birth_date, photos, gender,
distance, job_name, job_title, school_name, school_id,
ping_time, top_song, instagram_photos)
elif self.user_type is 'Me':
elif self.user_type == 'Me':
return UserModel(self.id, name, bio, age, birth_date, photos, gender,
distance, job_name, job_title, school_name, school_id,
ping_time, top_song, instagram_photos)
Expand All @@ -208,9 +198,9 @@ def _decode_age(self):
def _decode_gender(self):
"""Converts gender to a human readable format"""
gender = self.const.gender
if gender is 1:
if gender == 1:
return 'female'
elif gender is 0:
elif gender == 0:
return 'male'

def _decode_distance(self):
Expand All @@ -231,5 +221,4 @@ def _decode_theme_song(self):
'id': theme_s.id,
'artist': theme_s.artists[0].name}

if __name__ == '__main__':
pass
pass
2 changes: 1 addition & 1 deletion tinder_api/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'platform': 'ios',
'content-type': 'application/json',
'User-agent': 'Tinder/7.5.3 (iPohone; iOS 10.3.2; Scale/2.00)',
'X-Auth-Token': tinder_token,
'X-Auth-Token': 'b5210594-06ae-40b6-a3db-05f10308e5bb',
}

host = 'https://api.gotinder.com'
Expand Down