get manuals first step

This commit is contained in:
Cayo Puigdefabregas 2023-07-06 11:39:37 +02:00
parent 2f9a2edb44
commit 36c61d49ff
2 changed files with 12 additions and 3 deletions

View File

@ -65,6 +65,9 @@
<div class="card">
<div class="card-body">
{% for m in manuals.ifixit %}
{{ m }}<br />
{% endfor %}
<h3 class="nav-link mt-5" style="color: #993365">{{ device_real.type }} - {{ device_real.verbose_name }}</h3>
<div class="row">
<div class="col-12">

View File

@ -40,6 +40,7 @@ class DidView(View):
self.get_device()
self.get_last_dpp()
self.get_before_dpp()
self.get_manuals()
if self.accept_json():
return jsonify(self.get_result())
@ -185,14 +186,19 @@ class DidView(View):
return {'data': dpps}
def get_manuals(self):
self.params = "{} {}".format(self.device.manufacturer, self.model)
params = {
"manufacturer": 'HP' or self.device.manufacturer,
"model": self.device.model,
}
self.params = json.dumps(params)
manuals = {'ifixit': {}, 'icecat': {}}
manuals['ifixit'] = self.request_manuals('ifixit')
manuals['icecat'] = self.request_manuals('icecat')
return manuals
# import pdb; pdb.set_trace()
self.context['manuals'] = manuals
def request_manuals(self, prefix):
url = app.config('URL_MANUALS')
url = app.config['URL_MANUALS']
if not url:
return {}