-
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.
- Loading branch information
1 parent
be686d4
commit 39564e1
Showing
1 changed file
with
19 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
from kingfisher_scrapy.spiders.mexico_nuevo_leon_base import MexicoNuevoLeonBase | ||
import scrapy | ||
|
||
from kingfisher_scrapy.base_spider import SimpleSpider | ||
from kingfisher_scrapy.util import components, handle_http_error | ||
|
||
class MexicoNuevoLeonRecords(MexicoNuevoLeonBase): | ||
|
||
class MexicoNuevoLeonRecords(SimpleSpider): | ||
""" | ||
Domain | ||
Secretaría de Infraestructura del Gobierno del Estado de Nuevo León | ||
Bulk download documentation | ||
http://si.nl.gob.mx/transparencia/acerca-del-proyecto | ||
http://si.nl.gob.mx/transparencia/publicaciones | ||
""" | ||
name = 'mexico_nuevo_leon_records' | ||
|
||
# BaseSpider | ||
skip_pluck = 'Already covered (see code for details)' # mexico_nuevo_leon_releases | ||
|
||
# SimpleSpider | ||
data_type = 'record_package' | ||
|
||
# CompressedFileSpider | ||
file_name_must_contain = 'RecordPackage' | ||
def start_requests(self): | ||
yield scrapy.Request( | ||
'http://si.nl.gob.mx/siasi_ws/api/ocds/DescargarRecordPackage?usuario=undefined&servidor=undefined', | ||
meta={'file_name': 'list.json'}, | ||
callback=self.parse_list | ||
) | ||
|
||
@handle_http_error | ||
def parse_list(self, response): | ||
content = response.json() | ||
url = content['urlWebOcdspackage'] | ||
if url: | ||
yield self.build_request(url, formatter=components(-1)) |