Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 439-new-portugal
# Conflicts: # kingfisher_scrapy/spiders/portugal_base.py # kingfisher_scrapy/spiders/portugal_records.py # kingfisher_scrapy/spiders/portugal_releases.py
- Loading branch information
Showing
6 changed files
with
70 additions
and
24 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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import json | ||
|
||
import scrapy | ||
|
||
from kingfisher_scrapy.base_spider import SimpleSpider | ||
from kingfisher_scrapy.util import components, handle_http_error | ||
|
||
|
||
class NigeriaBudeshiBase(SimpleSpider): | ||
def start_requests(self): | ||
yield scrapy.Request( | ||
'https://budeshi.ng/api/project_list', | ||
meta={'file_name': 'project_list.json'}, | ||
callback=self.parse_list | ||
) | ||
|
||
@handle_http_error | ||
def parse_list(self, response): | ||
project_list = json.loads(response.text) | ||
for project in project_list: | ||
yield self.build_request(self.url.format(project['id']), formatter=components(-2)) | ||
if self.sample: | ||
return |
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.nigeria_budeshi_base import NigeriaBudeshiBase | ||
|
||
|
||
class NigeriaBudeshiRecords(NigeriaBudeshiBase): | ||
""" | ||
API documentation | ||
https://budeshi.ng/Api | ||
Spider arguments | ||
sample | ||
Download only the first record package from https://budeshi.ng/api/project_list. | ||
""" | ||
name = 'nigeria_budeshi_records' | ||
data_type = 'record_package' | ||
url = 'https://budeshi.ng/api/record/{}' |
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.nigeria_budeshi_base import NigeriaBudeshiBase | ||
|
||
|
||
class NigeriaBudeshiReleases(NigeriaBudeshiBase): | ||
""" | ||
API documentation | ||
https://budeshi.ng/Api | ||
Spider arguments | ||
sample | ||
Download only the first record package from https://budeshi.ng/api/project_list. | ||
""" | ||
name = 'nigeria_budeshi_releases' | ||
data_type = 'release_package' | ||
url = 'https://budeshi.ng/api/releases/{}' |
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
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