4

I want to get some price quotes from a bitcoin exchange called bitonic(.nl). On their frontpage they´ve got a little form on which you can fill in either an amount in Bitcoins or in Euros. If you fill in the bitcoin field the Euro-field gets updated, and if you enter an amount in Euros the Bitcoin-field gets updated (probably using javascript).

I now want to use the Python requests library to fill in the form and read out the resulting quote. I know how to request a page with requests (r = requests.get('http://bitconic.nl')), and I know you can do a similar thing using requests.post(). The problem is now that I don't know how to fill in this form and read out the result when the form is filled in using javascript.

Does anybody have any idea how I could do this? All tips are welcome!

2
  • You can simply intercept the post request done via browser, for doing this you can use a sniffer like Wireshark or some firefox/chrome extension. Commented Dec 27, 2013 at 14:10
  • 2
    Use a browser extension like Firebug to look at the request being sent when you update the field on their website, and then try to re-create the same request using Python-requests. Commented Dec 27, 2013 at 14:11

2 Answers 2

1

I originally assumed that a simple form like this would not involve any HTTP request at all, and be done exclusively in (non-Ajax) Javascript. However, it does appear to make an HTTP request, so you can use requests to do the same thing.

response = requests.post('https://bitonic.nl/json/', data={'part': 'rate_convert', 'check': 'euros', 'euros': 46})
print response.json()
Sign up to request clarification or add additional context in comments.

Comments

0

You can also download bitcoin quotes from here for free:

http://www.quandl.com/markets/bitcoin

The data is updated daily for several exchanges and different currencies, and is very "download" friendly. No registration needed if you need less than 50 requests per day.

Here is an API description on how to get the data:

http://www.quandl.com/help/api

Getting bitcoin quotes in csv is as easy as:

http://www.quandl.com/api/v1/datasets/BITCOIN/BTCDEEUR.csv

Regards.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.