-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: spiders: add all available publishers from
Mexico Plataforma Digital Nacional
- Loading branch information
Showing
9 changed files
with
174 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
kingfisher_scrapy/spiders/mexico_mexico_state_sesaemm_plataforma_digital_nacional.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from kingfisher_scrapy.spiders.mexico_plataforma_digital_nacional_base import MexicoPlataformaDigitalNacionalBase | ||
|
||
|
||
class MexicoMexicoStateSESAEMMPlataformaDigitalNacional(MexicoPlataformaDigitalNacionalBase): | ||
""" | ||
Domain | ||
Secretaría Ejecutiva del Sistema Estatal Anticorrupción del Estado de México y Municipios (SESAEMM) (Mexico) - | ||
Plataforma Digital Nacional | ||
Bulk download documentation | ||
https://plataformadigitalnacional.org/contrataciones | ||
""" | ||
name = 'mexico_mexico_state_sesaemm_plataforma_digital_nacional' | ||
|
||
# MexicoPlataformaDigitalNacionalBase | ||
publisher_id = 'SESAEMM_EDOMEX' |
15 changes: 15 additions & 0 deletions
15
kingfisher_scrapy/spiders/mexico_michoacan_sesea_plataforma_digital_nacional.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from kingfisher_scrapy.spiders.mexico_plataforma_digital_nacional_base import MexicoPlataformaDigitalNacionalBase | ||
|
||
|
||
class MexicoMichoacanSESEAPlataformaDigitalNacional(MexicoPlataformaDigitalNacionalBase): | ||
""" | ||
Domain | ||
Secretaría Ejecutiva del Sistema Estatal Anticorrupción del Estado de Michoacán (SESEA) (Mexico) - | ||
Plataforma Digital Nacional | ||
Bulk download documentation | ||
https://plataformadigitalnacional.org/contrataciones | ||
""" | ||
name = 'mexico_michoacan_sesea_plataforma_digital_nacional' | ||
|
||
# MexicoPlataformaDigitalNacionalBase | ||
publisher_id = 'SESEA_MCH' |
39 changes: 39 additions & 0 deletions
39
kingfisher_scrapy/spiders/mexico_plataforma_digital_nacional_base.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import json | ||
|
||
import scrapy | ||
|
||
from kingfisher_scrapy.base_spiders import IndexSpider | ||
from kingfisher_scrapy.util import handle_http_error | ||
|
||
|
||
class MexicoPlataformaDigitalNacionalBase(IndexSpider): | ||
# BaseSpider | ||
root_path = 'data.item' | ||
|
||
# SimpleSpider | ||
data_type = 'release' | ||
|
||
# IndexSpider | ||
limit = '/pagination/pageSize' | ||
result_count_pointer = '/pagination/total' | ||
start_page = 1 | ||
use_page = True | ||
|
||
# Local | ||
base_url = 'https://api.plataformadigitalnacional.org/s6/api/v1/search?supplier_id={}' | ||
|
||
# publisher_id must be provided by subclasses. | ||
|
||
def start_requests(self): | ||
yield scrapy.Request(self.base_url.format(self.publisher_id), meta={'file_name': 'page-0.json'}, | ||
callback=self.parse_list, method='POST') | ||
|
||
@handle_http_error | ||
def parse_list(self, response): | ||
data = self.parse_list_loader(response) | ||
yield from self.parse(response) | ||
for value in self.range_generator(data, response): | ||
payload = json.dumps({'page': value, 'pageSize': 10}) | ||
yield scrapy.Request(self.base_url.format(self.publisher_id), body=payload, | ||
meta={'file_name': f'page-{value}.json'}, method='POST', | ||
headers={'Accept': 'application/json', 'Content-Type': 'application/json'}) |
15 changes: 15 additions & 0 deletions
15
kingfisher_scrapy/spiders/mexico_puebla_state_seseap_plataforma_digital_nacional.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from kingfisher_scrapy.spiders.mexico_plataforma_digital_nacional_base import MexicoPlataformaDigitalNacionalBase | ||
|
||
|
||
class MexicoPueblaStateSESEAPlataformaDigitalNacional(MexicoPlataformaDigitalNacionalBase): | ||
""" | ||
Domain | ||
Secretaría Ejecutiva del Sistema Estatal Anticorrupción del Estado de Puebla (SESEAP) (Mexico) - | ||
Plataforma Digital Nacional | ||
Bulk download documentation | ||
https://plataformadigitalnacional.org/contrataciones | ||
""" | ||
name = 'mexico_puebla_state_seseap_plataforma_digital_nacional' | ||
|
||
# MexicoPlataformaDigitalNacionalBase | ||
publisher_id = 'SESAE_PUE' |
15 changes: 15 additions & 0 deletions
15
kingfisher_scrapy/spiders/mexico_quintana_roo_sesaeqroo_plataforma_digital_nacional.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from kingfisher_scrapy.spiders.mexico_plataforma_digital_nacional_base import MexicoPlataformaDigitalNacionalBase | ||
|
||
|
||
class MexicoQuintanaRooSESAEQROOPlataformaDigitalNacional(MexicoPlataformaDigitalNacionalBase): | ||
""" | ||
Domain | ||
Secretaría Ejecutiva del Sistema Anticorrupción del Estado de Quintana Roo (SESAEQROO) (Mexico) - | ||
Plataforma Digital Nacional | ||
Bulk download documentation | ||
https://plataformadigitalnacional.org/contrataciones | ||
""" | ||
name = 'mexico_quintana_roo_sesaeqroo_plataforma_digital_nacional' | ||
|
||
# MexicoPlataformaDigitalNacionalBase | ||
publisher_id = 'SESAE_QROO' |
14 changes: 14 additions & 0 deletions
14
kingfisher_scrapy/spiders/mexico_shcp_plataforma_digital_nacional.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from kingfisher_scrapy.spiders.mexico_plataforma_digital_nacional_base import MexicoPlataformaDigitalNacionalBase | ||
|
||
|
||
class MexicoSHCPPlataformaDigitalNacional(MexicoPlataformaDigitalNacionalBase): | ||
""" | ||
Domain | ||
Secretaría de Hacienda y Crédito Público (SHCP) (Mexico) - Plataforma Digital Nacional | ||
Bulk download documentation | ||
https://plataformadigitalnacional.org/contrataciones | ||
""" | ||
name = 'mexico_shcp_plataforma_digital_nacional' | ||
|
||
# MexicoPlataformaDigitalNacionalBase | ||
publisher_id = 'SHCP' |
15 changes: 15 additions & 0 deletions
15
kingfisher_scrapy/spiders/mexico_veracruz_state_sesea_plataforma_digital_nacional.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from kingfisher_scrapy.spiders.mexico_plataforma_digital_nacional_base import MexicoPlataformaDigitalNacionalBase | ||
|
||
|
||
class MexicoVeracruzStateSESEAPlataformaDigitalNacional(MexicoPlataformaDigitalNacionalBase): | ||
""" | ||
Domain | ||
Secretaría Ejecutiva del Sistema Estatal Anticorrupción de Veracruz de Ignacio de la Llave (SESEA) (Mexico) - | ||
Plataforma Digital Nacional | ||
Bulk download documentation | ||
https://plataformadigitalnacional.org/contrataciones | ||
""" | ||
name = 'mexico_veracruz_state_sesea_plataforma_digital_nacional' | ||
|
||
# MexicoPlataformaDigitalNacionalBase | ||
publisher_id = 'SESEA_VER' |