Найти - Пользователи
Полная версия: Json
Начало » Python для новичков » Json
1
beren43

Здравствуйте.
Решаю тренеровочную задачу:
Вывести на экран данные по заблокированным ресурсам за период с 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')
А в целом, готовый код не нужен. Нужны советы как можно реализовать.
Спасибо.
FishHook
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.
beren43
Спасибо. Есть идеи, как дальше делать ?
beren43
Появилась идея
 ip  = i.get("recordsAdded")[0].get ("ip")

Но как вывести с первого по последний ip ?
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB