Created
January 11, 2018 15:47
-
-
Save HenryYang/cdc96a2819baca5f0247998bfa8e5096 to your computer and use it in GitHub Desktop.
Catch Germany DB train Real-time GPS via in-train WiFi
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# coding: utf8 | |
import requests | |
import sys | |
import os | |
import random | |
import time | |
import threading | |
def t1(): | |
r = requests.get('https://portal.imice.de/api1/rs/status') | |
fp = open("DB.txt", "a") | |
fp.write(r.text) | |
fp.write("\n") | |
def t2(): | |
while 1: | |
t1() | |
time.sleep(3) | |
if __name__ == '__main__': | |
reload(sys) | |
sys.setdefaultencoding('utf-8') | |
t = threading.Thread(target=t2) | |
t.start() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thalys API via in-train WiFi
https://www.ombord.info/api/jsonp/position/