[ckan-dev] No attribute 'tracking_summary'

Teg-wende Idriss TINTO tinto.jean at titinto.net
Tue Jul 12 09:51:45 UTC 2016


Hi Martin,

The API request return a json result (attached) with the traking_summary
array.
The "include_tracking=true" was the key. I solved the problem by adding
that parameter to my request like this:

def most_viewed_datasets(num_datasets=NUM_MOST_VIEWED_DATASETS):

	context = {'model': model,

	            'session': model.Session,

	               'user': toolkit.c.user or toolkit.c.author}

	data = {'rows': num_datasets,

	                'sort': u'views_total desc',

	                'facet': u'false',

			'include_tracking': u'true'}

Thank you very much for your help

Best

Le 10/07/2016 à 21:50, Martin Burchell a écrit :
> On 09/07/16 23:15, Teg-wende Idriss TINTO wrote:
>> Hi Martin,
>> thank you for your response.
>>
>> I have set it, and also run tracking update and search-index rebuild.
> 
> If you're calling package_show you need to set the parameter
> include_tracking to true.
> 
> What happens if you call package_show using the API with
> 
> <your
> site>/api/3/action/package_show?id=<your-dataset-id>&include_tracking=true
> 
> 
> Best regards,
> 
> 

-- 
Teg-Wende Idriss TINTO
Software Engineer
Open Knowledge Burkina Faso
Open Burkina
- Mobile : (00226) 70102936
- Email : tinto.jean at titinto.net
- Twitter : @titinto_
- skype : tinto.jean
- Telegram : titinto
PGP Key-ID: 0x40A4F0FE
PGP Fingerprint: D58E 610C 5F14 8E8F E13E 04DB BFE9 D633 40A4 F0FE
-------------- next part --------------
{"help": "http://ckan.localdomain/api/3/action/help_show?name=package_show", "success": true, "result": {"license_title": "Creative Commons Attribution", "maintainer": "", "relationships_as_object": [], "private": false, "maintainer_email": "", "num_tags": 0, "id": "4fd7e6bd-3bce-4c33-a14d-a6ebedc9c6dc", "metadata_created": "2016-07-04T06:31:32.827606", "metadata_modified": "2016-07-04T06:33:06.097843", "author": "", "author_email": "", "state": "active", "version": "", "creator_user_id": "a23904cf-bd46-42e1-ad65-aefee441c6ed", "type": "dataset", "resources": [{"mimetype": null, "cache_url": null, "tracking_summary": {"total": 0, "recent": 0}, "hash": "", "description": "Une ressource peut-\u00eatre un fichier ou un lien vers un fichier contenant des donn\u00e9es utiles.", "name": "Une ressource peut-\u00eatre un fichier ou un lien vers u", "format": "xslx", "url": "http://ckan.localdomain/dataset/4fd7e6bd-3bce-4c33-a14d-a6ebedc9c6dc/resource/00558f89-a9c3-40ff-92da-087ed279b6db/download/nombre-danimaux-de-trait-distribue-par-region-et-par-annee-bufs.ods", "datastore_active": false, "cache_last_updated": null, "package_id": "4fd7e6bd-3bce-4c33-a14d-a6ebedc9c6dc", "created": "2016-07-04T06:31:59.256642", "state": "active", "mimetype_inner": null, "last_modified": "2016-07-04T06:31:59.232998", "position": 0, "revision_id": "ded16e12-b183-4093-9c20-a09b258fb359", "url_type": "upload", "id": "00558f89-a9c3-40ff-92da-087ed279b6db", "resource_type": null, "size": null}], "num_resources": 1, "tags": [], "tracking_summary": {"total": 1, "recent": 1}, "groups": [], "license_id": "cc-by", "relationships_as_subject": [], "organization": {"description": "Minist\u00e8re de l'\u00e9ducation nationale et de l'alphabetisation", "created": "2016-06-25T18:14:00.039216", "title": "MENA", "name": "mena", "is_organization": true, "state": "active", "image_url": "", "revision_id": "569b44cf-5274-4b4e-a68c-6c95161045d5", "type": "organization", "id": "3fddd70e-fb53-4f1e-80d2-788bb77526c7", "approval_status": "approved"}, "name": "un-jeu-de-donnees-ckan-est-une-collection-d", "isopen": true, "url": "", "notes": "Un jeu de donn\u00e9es CKAN est une collection de ressources (telles que des fichiers), ainsi qu'une description et d'autres information, avec une URL fixe. Les jeux de donn\u00e9es sont ce que l'utilisateur voit lorsqu'il effectue une recherche de donn\u00e9es. ", "owner_org": "3fddd70e-fb53-4f1e-80d2-788bb77526c7", "extras": [], "license_url": "http://www.opendefinition.org/licenses/cc-by", "title": "Un jeu de donn\u00e9es CKAN est une collection d", "revision_id": "b7e78c70-61d5-4b1d-8792-af1b2c181612"}}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20160712/76fe0d46/attachment-0003.sig>


More information about the ckan-dev mailing list