-
December 9th, 2014, 06:50 PM
#1
Python client for lightstreamer
Hi All, I would like to ask if anyone can provide a basic Python Client example.
I think a very basic and useful example could be a Python code that display push received time/date of the example http://demos.lightstreamer.com/HelloWorld/ .
I already red the Generic Protocol Documentation, I'm able to create the createsession.txt url but it doesn't refresh in my code (push doesn't work).
I searched a lot in web, but I didn't find any that could clarify this (https://github.com/dw/py-lightstreamer actually doesn't works and/or there isn't a documentation).
I have last Python, 3.4
Any help will be appreciated.
Thanks and br.
-
December 10th, 2014, 09:56 AM
#2
Hi Colombao,
I'm not aware of more recent ready-made examples for Python.
If you start from https://github.com/dw/py-lightstreamer (which was not developed by us) and let us know what is not working, we can support you in fixing any issue with the Lightstreamer protocol.
Thanks,
Alessandro
-
December 10th, 2014, 08:34 PM
#3
Hi Alessandro, many thanks for your quick feedback. Frankly speaking, I don't know how to proceed after "import lightstreamer" (the example included in the library web page, "barebones.py" gives a lot of different error that make me feel that there is something completely wrong from the base).
If anyone of Lighstreamer team could know how to do a client in python, I think a very basic, useful and "end to end" example could be a Python code that display push received time/date of the example http://demos.lightstreamer.com/HelloWorld/ .
Please note that I converted the original lightstreamer library to be compatible with python 3.4 one, using Python 2to3 converter. Maybe something went wrong during conversion. An hypothesis could be that the library is not convertible but compatible only with Python 2.7, but even in this case I don't have an example of how use that library.
Anyone can help me?
Thanks and best regards,
Colombao
-
December 11th, 2014, 11:32 AM
#4
Colombao,
Thanks for the suggestion. A quick Python client example does make sense, so that we can add it to our demo database: http://demos.lightstreamer.com/
We will try to work on it over the next few weeks and publish it on GitHub. We'll let you know.
Cheers,
Alessandro
-
December 11th, 2014, 11:58 AM
#5
Hi Alessandro,
thanks again for you help. Since Python is more a "mathematical" language than an "Interface" one, in my honest opinion it could be enough to print received data directly into standard output (eg. using "print()" ), without the necessity of developing a real interface, for which there are more appropriate languages. I'll follow this thread!
Thanks again!
Colombao
-
December 11th, 2014, 12:31 PM
#6
Ok, will use printf() to keep the example as simple as possible.
Thanks
-
December 18th, 2014, 05:10 PM
#7
We have just released on GitHub a simple Python script that shows a minimal client-side implementation of the Lightstreamer Server Text mode Protocol.
https://github.com/Weswit/Lightstrea...-client-python
-
December 23rd, 2014, 03:24 PM
#8
Thanks gianluca.finocchiaro. It looks like that demo is featured on the Lightstreamer demo page now.
When I execute the script, I get a syntax error. Any idea why? I'm running Python 2.6.
>python stock_list_demo.py
File "stock_list_demo.py", line 92
k: self._decode(v, curr_item.get(k)) for k, v
^
SyntaxError: invalid syntax
-
December 23rd, 2014, 04:20 PM
#9
Dictionary comprehensions are not supported in python 2.6. You need to use 2.7 to run this. You may want to update your requirements to say 2.7 instead of any 2.x version.
Last edited by Jim; December 23rd, 2014 at 04:35 PM.
-
December 24th, 2014, 09:20 AM
#10
Hi Jim.
thanks for reporting this issue. I have just the fixed backward compatibility with Python 2.6, now available on GitHub.
Let me know for any further problem.
Regards,
Gianluca
Similar Threads
-
By Alessandro in forum Client SDKs
Replies: 1
Last Post: December 18th, 2014, 05:15 PM
-
By keyan in forum Client SDKs
Replies: 4
Last Post: December 18th, 2014, 05:12 PM
-
By subuta in forum Client SDKs
Replies: 2
Last Post: January 5th, 2012, 08:53 AM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 03:01 PM.
Bookmarks