[lxc-users] Getting the LXD rest api to play nice?

Kevin LaTona lists at studiosola.com
Tue May 19 23:04:11 UTC 2015


On May 19, 2015, at 3:07 PM, Tycho Andersen <tycho.andersen at canonical.com> wrote:

> On Tue, May 19, 2015 at 01:05:08PM -0700, Kevin LaTona wrote:
>> 
>> Better yet any one on the list is doing this using the Python Requsts module?
>> 
>> Hate to waste time drilling down into requests, if it's a LXD api issue so early in the release cycle.
> 
> There is http://github.com/zulcss/pylxd and the in tree

The link to their docs is down, and no time to read their source code to do a quick test on the LXD rest api.





> /scripts/lxd-images, although neither use the requests module.

This  is using domain sockets…….so not much help here right now.



I was in the process of building out a Python based SSH command line library.

And it hit me that the LXD Rest api should be doing all of this.

So why reinvent the wheel and spend all the time parsing out stdout if a JSON doc is available.







> 
> If you can paste your code and error, perhaps we can provide some
> insight.


I've not really used Requests much … but thought it might be the quickest way to see how using the LDX's rest api works out vs doing it from command line calls.


tried about 6 or 7 ways to get Python, SSL, Web and LDX rest to play nice…. none worked so far.


Here is the last bits of test….. best I know from requests docs this should work to get some kind of a response.

So far no matter how I try to connect to my LDX rest server I can't get past a ping… so at least it's running at some level is a start.


Any thoughts or ideas much appreciated from anyone.


import requests

# r = requests.get('https://192.168.0.50:8443/')
# requests.exceptions.SSLError: [Errno 1] _ssl.c:503: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

# r = requests.get('https://192.168.0.50:8443/1.0/', verify=True)
# requests.exceptions.SSLError: [Errno 1] _ssl.c:503: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version


# r = requests.get('https://192.168.0.50:8443/1.0/',verify=False)
# requests.exceptions.SSLError: [Errno 1] _ssl.c:503: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version

print(r.text)



Thanks
-Kevin


More information about the lxc-users mailing list