Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added "content_hash" and "s_number" fields to like/pass/superlike requests #118

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
12 changes: 6 additions & 6 deletions pynder/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ def profile(self):
def update_profile(self, profile):
return self._post("/profile", profile)

def like(self, user):
return self._get("/like/{}".format(user))
def like(self, user, content_hash, s_number):
return self._get("/like/{}?content_hash=\"{}\"&s_number=\"{}\"".format(user, content_hash, s_number))

def dislike(self, user):
return self._get("/pass/{}".format(user))
def dislike(self, user, content_hash, s_number):
return self._get("/pass/{}?content_hash=\"{}\"&s_number=\"{}\"".format(user, content_hash, s_number))

def message(self, user, body):
return self._post("/user/matches/{}".format(user),
Expand All @@ -93,8 +93,8 @@ def user_info(self, user_id):
def ping(self, lat, lon):
return self._post("/user/ping", {"lat": lat, "lon": lon})

def superlike(self, user):
result = self._post("/like/{}/super".format(user))
def superlike(self, user, content_hash, s_number):
result = self._post("/like/{}/super".format(user), {"content_hash": content_hash, "s_number": s_number})
if 'limit_exceeded' in result and result['limit_exceeded']:
raise errors.RequestError("Superlike limit exceeded")
return result
Expand Down
20 changes: 11 additions & 9 deletions pynder/constants.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
API_BASE = 'https://api.gotinder.com'
API_BASE = "https://api.gotinder.com"

USER_AGENT = 'Tinder Android Version 6.4.1'
USER_AGENT = "Tinder/6.8.0 (iPhone; iOS 9.0.2; Scale/2.00)"

HEADERS = {
"Content-Type": "application/json; charset=utf-8",
"User-Agent": USER_AGENT,
"Host": API_BASE,
"os_version": "1935",
"app-version": "371",
"platform": "android", # XXX with ios we run in an error
"Accept-Encoding": "gzip"
"x-client-version": "68023",
"app-version": "1824",
"Accept-Encoding": "gzip, deflate",
"platform": "ios",
"Accept-Language": "it;q=1, en-US;q=0.9",
"Accept": "*/*",
"Connection": "keep-alive",
"os_version": "90000000002",
"Content-type": "application/json; charset=utf-8"
}

GENDER_MAP = ["male", "female"]
Expand Down
2 changes: 1 addition & 1 deletion pynder/models/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, data, session):
self._data = data
self.id = data['_id']

SIMPLE_FIELDS = ("name", "bio", "birth_date", "ping_time")
SIMPLE_FIELDS = ("name", "bio", "birth_date", "ping_time", "content_hash", "s_number")
for f in SIMPLE_FIELDS:
setattr(self, f, data[f])

Expand Down
4 changes: 2 additions & 2 deletions pynder/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ def nearby_users(self, limit=10):
users = response['results'] if 'results' in response else []
ret = []
for u in users:
if not u["_id"].startswith("tinder_rate_limited_id_"):
ret.append(models.Hopeful(u, self))
if not u["user"]["_id"].startswith("tinder_rate_limited_id_"):
ret.append(models.Hopeful(u["user"], self))
return ret

def update_profile(self, profile):
Expand Down