Bitcoin Forum

Bitcoin => Project Development => Topic started by: Decoded on September 11, 2016, 09:44:31 PM



Title: Anyone with experience with python websockets?
Post by: Decoded on September 11, 2016, 09:44:31 PM
Hey guys, I'm trying to make an app that uses the block.io Wendover API. My app is something like BitNotify, with more advanced options. For example if you're using a HD wallet, you could input the xPub and my service will automatically generate all addresses 1 address ahead, and give you notifications when you have a balance change in any one of those addresses.

I've got the mail service down, the xPub expander done, just need the web socket API. I know how to work with JSON, too.

I am currently using websocket-client (pip install websocket-client), and am able to connect to the block.io server. When I issue a command, I can get the response (Success). But how do I get the JSON object sent to me?


Title: Re: Anyone with experience with python websockets?
Post by: dc1a0 on September 12, 2016, 12:59:56 AM
Admittedly, I'm not a complete expert but according to your post, you want to use another server's API correct? When I was looking into doing that I came across a library called "Requests" Found here: http://docs.python-requests.org/en/master/

Maybe this might make things easier for you?


Title: Re: Anyone with experience with python websockets?
Post by: Decoded on September 12, 2016, 06:55:46 AM
Admittedly, I'm not a complete expert but according to your post, you want to use another server's API correct? When I was looking into doing that I came across a library called "Requests" Found here: http://docs.python-requests.org/en/master/

Maybe this might make things easier for you?

No, sorry that's not what i'm looking for. I am looking for another python library that is better documented and will allow me to retrieve the json object from the websocket. I want to use the block.io API.


Title: Re: Anyone with experience with python websockets?
Post by: ads2alpha on September 13, 2016, 04:58:07 PM
You just spin up a TCP client on your machine. It should go to the server, and if there is anything to retrieve, it will display in your terminal or wherever you tell it to. If there is nothing to retrieve but the header with a 2xx status, then it's normal you don't get any JSON.

The simplest TCP client in Python is kind of ten lines of code. It uses the standard socket library. PM me for my Skype and I could give you a code snippet and some help.


Title: Re: Anyone with experience with python websockets?
Post by: PremiumCodeX on September 13, 2016, 06:57:17 PM
Why do you think that there will be a JSON object? Nevertheless, I found this this (https://github.com/BlockIo/block_io-python) project successful to use to check balances on Block io.