Форум сайта python.su
Здравствуйте.
Решаю тренеровочную задачу:
Вывести на экран данные по заблокированным ресурсам за период с 25.03.2014 по 30.03.2014 с https://antizapret.info/ в формате:
ip1 > domain
ip2 > domain
Почитавши, https://antizapret.info/api.php можно использовать https://api.antizapret.info/diff.php…3-30&type=json
Вот до чего пока дошёл я
import urllib.request import urllib.parse import json doc = urllib.request.urlopen("https://api.antizapret.info/diff.php?dateStart=2014-03-25&dateCurrent=2014-03-30&type=json") data = doc.read() encoding = doc.info().get_content_charset('utf-8')
data = doc.read() encoding = doc.info().get_content_charset('utf-8')
Офлайн
The info() method returns an instance of the class mimetools.Message containing meta-information associated with the URL. When the method is HTTP, these headers are those returned by the server at the head of the retrieved HTML page (including Content-Length and Content-Type). When the method is FTP, a Content-Length header will be present if (as is now usual) the server passed back a file length in response to the FTP retrieval request. A Content-Type header will be present if the MIME type can be guessed. When the method is local-file, returned headers will include a Date representing the file’s last-modified time, a Content-Length giving file size, and a Content-Type containing a guess at the file’s type. See also the description of the mimetools module.
Офлайн
Спасибо. Есть идеи, как дальше делать ?
Офлайн
Появилась идея
ip = i.get("recordsAdded")[0].get ("ip")
Офлайн