-
Notifications
You must be signed in to change notification settings - Fork 12
/
ecuador_sercop_bulk.py
32 lines (27 loc) · 1.13 KB
/
ecuador_sercop_bulk.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from kingfisher_scrapy.base_spiders import CompressedFileSpider, PeriodicSpider
from kingfisher_scrapy.util import components, join
class EcuadorSERCOPBulk(CompressedFileSpider, PeriodicSpider):
"""
Domain
Servicio Nacional de Contratación Pública (SERCOP)
Spider arguments
from_date
Download only data from this month onward (YYYY-MM format). Defaults to '2015-01'.
until_date
Download only data until this month (YYYY-MM format). Defaults to the current month.
API documentation
https://datosabiertos.compraspublicas.gob.ec/PLATAFORMA/datos-abiertos/api
Bulk download documentation
https://datosabiertos.compraspublicas.gob.ec/PLATAFORMA/datos-abiertos
"""
name = 'ecuador_sercop_bulk'
# BaseSpider
date_format = 'year-month'
default_from_date = '2015-01'
root_path = 'item'
# SimpleSpider
data_type = 'release_package'
# PeriodicSpider
pattern = 'https://datosabiertos.compraspublicas.gob.ec/PLATAFORMA/download'\
'?type=json&year={0:%Y}&month={0:%m}&method=all'
formatter = staticmethod(join(components(-1), extension='zip'))