Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def on_message(ws, message):
- print "Prisla data:"
- print message
- print "--------------"
- request = abstract_pb2.Request()
- request = message
- header = abstract_pb2.Header()
- print header.type
- print ".................."
- print request.data
- print "_________________"
- if (header.type == "Text" ):
- print "je to text"
- #text = Text_pb2.Text()
- #text.text = request.data
- #print text.text
- # ----------------------------------------------- vystup (poslu si "abc"):
- /usr/bin/python2.7 /home/martin/PycharmProjects/MEO_kamera/wsMEOcallbackPROTOBUFF_abstract.py
- --- request header ---
- GET /ws/protobuf/75?access_token=67bde5/usr/bin/python2.7 /home/martin/PycharmProjects/MEO_kamera/wsMEOcallbackPROTOBUFF_abstract.py
- --- request header ---
- GET /ws/protobuf/75?access_token=67bde5d1b5f14520a565d03deae877fb HTTP/1.1
- Upgrade: websocket
- Connection: Upgrade
- Host: 194.228.153.100:9000
- Origin: http://194.228.153.100:9000
- Sec-WebSocket-Key: e+CUcj7zS7+0/2cKGRXY+Q==
- Sec-WebSocket-Version: 13
- head2:value2
- head1:value1
- -----------------------
- --- response header ---
- HTTP/1.1 101 Switching Protocols
- Upgrade: websocket
- Connection: Upgrade
- Sec-WebSocket-Accept: ru7quF8dBgVZELkUbeD+OAI7mRE=
- -----------------------
- 'str' object has no attribute 'data'
- File "/usr/lib/python2.7/dist-packages/websocket.py", line 872, in _callback
- callback(self, *args)
- File "/home/martin/PycharmProjects/MEO_kamera/wsMEOcallbackPROTOBUFF_abstract.py", line 22, in on_message
- print request.data
- Prisla data:
- Text
- abc
- --------------
- ..................d1b5f14520a565d03deae877fb HTTP/1.1
- Upgrade: websocket
- Connection: Upgrade
- Host: 194.228.153.100:9000
- Origin: http://194.228.153.100:9000
- Sec-WebSocket-Key: e+CUcj7zS7+0/2cKGRXY+Q==
- Sec-WebSocket-Version: 13
- head2:value2
- head1:value1
- -----------------------
- --- response header ---
- HTTP/1.1 101 Switching Protocols
- Upgrade: websocket
- Connection: Upgrade
- Sec-WebSocket-Accept: ru7quF8dBgVZELkUbeD+OAI7mRE=
- -----------------------
- 'str' object has no attribute 'data'
- File "/usr/lib/python2.7/dist-packages/websocket.py", line 872, in _callback
- callback(self, *args)
- File "/home/martin/PycharmProjects/MEO_kamera/wsMEOcallbackPROTOBUFF_abstract.py", line 22, in on_message
- print request.data
- Prisla data:
- Text
- abc
- --------------
- ..................
Advertisement
Add Comment
Please, Sign In to add comment