[ckan-dev] intercepting http request info

George Sattler George.sattler at xvt.com.au
Thu Apr 4 21:58:40 UTC 2013


Thanks, Adrià. The wordpresser extention might just be the lead I've been looking for.

-----Original Message-----
From: ckan-dev-bounces at lists.okfn.org [mailto:ckan-dev-bounces at lists.okfn.org] On Behalf Of Adrià Mercader
Sent: Friday, 5 April 2013 5:24 AM
To: CKAN Development Discussions
Subject: Re: [ckan-dev] intercepting http request info

Hi George,

Perhaps the IMiddleware [1] interface could be useful for that, as it will allow you to hook into the Pylons middleware used by CKAN.
The only problem may be that there aren't many examples around. The only one I'm aware of is ckanext-wordpresser, an extension not really maintained right now and which I don't have much experience with, but that it does capture any HTTP request being made to CKAN.

Have a look at this to see if it gives you a start (I guess that basically you'd need to adapt the __call__ method to your own needs)

https://github.com/okfn/ckanext-wordpresser/blob/master/ckanext/wordpresser/plugin.py
https://github.com/okfn/ckanext-wordpresser/blob/master/ckanext/wordpresser/middleware.py

Hope this helps,

Adrià


[1] https://github.com/okfn/ckan/blob/master/ckan/plugins/interfaces.py#L44

On 3 April 2013 06:12, George Sattler <George.sattler at xvt.com.au> wrote:
> Hi
>
> I want to get http request information each time a CKAN page is 
> requested (for cookies and other bits and pieces). Does anyone know 
> what the best approach is?
>
>
>
> The two ideas I have upfront are:
>
> -          Create CKAN extension (though looking at the API - I can't see
> any hook for something like this)
>
> -          Extend the wsgi script
>
>
>
> If anyone's done this please let me know which would be the best approach.
>
> Thanks
>
> George
>
>
> ________________________________
> This email and any files transmitted with it is confidential and 
> intended solely for the use of the addressee. The unauthorised use, 
> dissemination, forwarding, printing or copying of this communication 
> is strictly prohibited. If you have received this communication in 
> error please notify us immediately by reply email and destroy this 
> communication. Any views and opinions presented in this email are 
> solely those of the author and do not necessarily represent the views 
> of XVT Solutions. The recipient should check this email and any 
> attachments for viruses. XVT Solutions accepts no liability for the 
> content of this email, and any damage caused by any viruses that could potentially be transmitted through this email.
>
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> http://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev
>

_______________________________________________
ckan-dev mailing list
ckan-dev at lists.okfn.org
http://lists.okfn.org/mailman/listinfo/ckan-dev
Unsubscribe: http://lists.okfn.org/mailman/options/ckan-dev




More information about the ckan-dev mailing list