[SOLVED] Looking for httplib or httplib2

Tags: #<Tag:0x00007f617e5780f0> #<Tag:0x00007f617e587f78> #<Tag:0x00007f617e587e10>

Playing around to implement group support for phoscon based hue bridge.
Now I am stuck at first step getting module to install to get http support inside rules.
I was able to install hpptplib2 by:

sudo pip install --upgrade --target=/datavol/openhab-2.5.1/openhab_conf/automation/lib/python httplib2

/datavol is maped to my container.

Unfortunately I get an error when importing the httplib2

TypeError: Error when calling the metaclass bases

seems to be an issue when using httplib2 with Jython.

Does any one know how to import httplib? pip does not know it.
Or any idea how to do http request from withing jython rules?

sudo pip install --upgrade --target=/datavol/openhab-2.5.1/openhab_conf/automation/lib/python requests

works

You are not forced to use a Python module either… there are lots of options available. There is the 1.x http Action, the 2.x http binding Action (IIRC, still in development), the http client shared in openHAB core, and any of the other Java classes.

The “requests” works perfect.

import requests

r =requests.get('http://{}/api/{}/groups'.format(HUE_BRIDGE, API_CODE))

An I have my JSON of groups