Skip to content

Commit

Permalink
Merge d611dd9 into 87cc079
Browse files Browse the repository at this point in the history
  • Loading branch information
aguilerapy committed Mar 17, 2021
2 parents 87cc079 + d611dd9 commit 2a2b3a8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
10 changes: 10 additions & 0 deletions docs/spiders.rst
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,16 @@ Scotland
scrapy crawl scotland_public_contracts
Slovenia
--------

.. autoclass:: kingfisher_scrapy.spiders.slovenia.Slovenia
:no-members:

.. code-block:: bash
scrapy crawl slovenia
Spain
-----

Expand Down
27 changes: 27 additions & 0 deletions kingfisher_scrapy/spiders/slovenia.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import scrapy

from kingfisher_scrapy.base_spider import SimpleSpider
from kingfisher_scrapy.util import components, handle_http_error


class Slovenia(SimpleSpider):
"""
Domain
Ministry of Public Administration Slovenia
"""
name = 'slovenia'

# SimpleSpider
data_type = 'release_package'

url = 'http://tbfy.ijs.si/public/ocds/mju/'

def start_requests(self):
yield scrapy.Request(self.url, meta={'file_name': 'list.html'}, callback=self.parse_list)

@handle_http_error
def parse_list(self, response):
html_urls = response.xpath('//a/@href').getall()
for url in html_urls:
if 'ocds' and 'json' in url:
yield self.build_request(f"{self.url}{url}", formatter=components(-1))

0 comments on commit 2a2b3a8

Please sign in to comment.