-
-
Save dchaplinsky/ce215a4c5b7ccef24c35 to your computer and use it in GitHub Desktop.
import requests | |
import json | |
from time import sleep | |
data = [] | |
print("Fetching page #%s" % 1) | |
r = requests.get("http://declarations.com.ua/search?format=opendata").json() | |
data += r["results"]["object_list"] | |
for page in range(2, r["results"]["paginator"]["num_pages"] + 1): | |
sleep(0.5) | |
print("Fetching page #%s" % page) | |
subr = requests.get( | |
"http://declarations.com.ua/search?format=opendata&page=%s" % page).json() | |
data += subr["results"]["object_list"] | |
print("Declarations exported %s" % len(data)) | |
with open("feed.json", "w") as fp: | |
json.dump(data, fp) |
Hi. Can you help me?
It was difference in full_name_suggest model
For request https://declarations.com.ua/office/%d0%9c%d1%96%d0%bd%d1%96%d1%81%d1%82%d0%b5%d1%80%d1%81%d1%82%d0%b2%d0%be%20%d1%8e%d1%81%d1%82%d0%b8%d1%86%d1%96%d1%97?format=json&page=2
it's look like this: http://prntscr.com/fb262o
For https://declarations.com.ua/declaration/5257?format=json and others
it's like this: http://prntscr.com/fb26y3
estate model is also different
Also I can't get any result for this query: https://declarations.com.ua/search?q=%D0%97%D0%B0%D0%B9%D1%86%D0%B5%D0%B2%D0%B0+%D0%A0%D0%BE%D0%BA%D1%81%D0%BE%D0%BB%D0%B0%D0%BD%D0%B0&format=json&page=1
However I get it from web site.
Can you fix it?
Check the updated docs and new API here: https://declarations.com.ua/api/
How to encode file feed.json from unicode to utf-8 properly? I can easily encode small file, using js, but 344megabutes can not be encoded with the same code that works on small files(