简体   繁体   English

使用python从网站传输实时数据

[英]transferring real time data from a website in python

I am programming in Python . 我正在用Python编程。 I would like to extract real time data from a webpage without refreshing it : http://www.fxstreet.com/rates-charts/currency-rates/ 我想从网页中提取实时数据而不刷新它http : //www.fxstreet.com/rates-charts/currency-rates/

I think the real time data webpage is written in AJAX but I am not quite sure.. I thought about opening an internet browser with the program but I do not really know/like this way... Is there an other way to do it? 我认为实时数据网页是用AJAX编写的,但我不太确定。。我考虑过使用该程序打开Internet浏览器,但我不太了解/喜欢这种方式...还有另一种方式可以做到这一点。 ?

I would like to fill a dictionnary in my program (or even a SQL database) with the latest numbers each second. 我想用每秒的最新数字填充程序(甚至SQL数据库)中的字典。 please help me in python, thanks! 请用python帮助我,谢谢!

To get the data, you'll need to look through the javascript and HTML source to find what URL it's hitting to get the data it's displaying. 要获取数据,您需要浏览javascript和HTML源代码以找到要获取其显示数据的URL。 Then, you can call that URL with urllib or your favorite python library and parse it 然后,您可以使用urllib或您喜欢的python库调用该URL并进行解析

Also, it may be easier if you use a plugin like Firebug that lets you watch the AJAX requests. 另外,如果您使用Firebug之类的插件来观看AJAX请求,则可能会更容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM