From 13440826d26e5eef6a986cdfb7a79a297573bdf4 Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Mon, 21 Oct 2013 15:13:48 +0200 Subject: [PATCH] Revert "[t411] Tenatative d'utilisation de l'API : Haha ! Elle marche pas :(" This reverts commit c4cf10649330060872be8fa9590089553635cc16. --- t411_torrents.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t411_torrents.py b/t411_torrents.py index 560c0ec..23dfd0b 100755 --- a/t411_torrents.py +++ b/t411_torrents.py @@ -8,7 +8,7 @@ import urllib2 import getpass #: url de login sur t411 -api_url = "https://api.t411.me/" +login_url = u"https://t411.me/users/login" # Pour récupérer la liste des torrents quand t est le contenu d'une page # d'historique @@ -24,15 +24,15 @@ def getid(url): def post(url, data): """Poste les ``data`` sur l'``url`` et renvoie la page obtenue.""" data = urllib.urlencode(data) - request = urllib2.Request(url, data) + request = urllib2.Request("http://www.t411.me/users/login", data) response = urllib2.urlopen(request) return response def do_connect(login, password): """Se logue et renvoie le cookie.""" - response = post(api_url + "auth/", {"username": login, "password": password}) - content = response.read() - return content + response = post(login_url, {"login": login, "password": password}) + cookie = response.headers["set-cookie"] + return cookie def connect(): """Demande login/password à l'utilisateur et se connecte.""" -- 2.39.2