Page 1 of 8 123 ... LastLast
Results 1 to 10 of 80

Hybrid View

  1. #1
    Member
    Join Date
    Dec 2014
    Location
    Milan
    Posts
    13

    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.

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    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

  3. #3
    Member
    Join Date
    Dec 2014
    Location
    Milan
    Posts
    13
    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

  4. #4
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    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

  5. #5
    Member
    Join Date
    Dec 2014
    Location
    Milan
    Posts
    13
    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

  6. #6
    Administrator
    Join Date
    Jul 2006
    Location
    Milan, Italy
    Posts
    521
    Ok, will use printf() to keep the example as simple as possible.
    Thanks

  7. #7
    Power Member
    Join Date
    Feb 2008
    Location
    Siracusa
    Posts
    161
    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

  8. #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

  9. #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 05:35 PM.

  10. #10
    Power Member
    Join Date
    Feb 2008
    Location
    Siracusa
    Posts
    161
    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

  1. Python Client Library for Lightstreamer
    By Alessandro in forum Client SDKs
    Replies: 1
    Last Post: December 18th, 2014, 06:15 PM
  2. how to comunicate lightstreamer server by python
    By keyan in forum Client SDKs
    Replies: 4
    Last Post: December 18th, 2014, 06:12 PM
  3. Replies: 2
    Last Post: January 5th, 2012, 09:53 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 05:20 AM.