Created
January 17, 2017 19:34
-
-
Save mfin/397321c2acfd26542476c63f5c64ea2c to your computer and use it in GitHub Desktop.
Gulf of Trieste AIS vessel positioning
This file contains hidden or 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/env python3 | |
import json | |
import requests | |
from bs4 import BeautifulSoup | |
response = {} | |
request = requests.get('http://bedanec.agotech.com/AIS/AIS.PHP') | |
data = BeautifulSoup(request.text, 'html.parser') | |
rows = data.find_all('tr') | |
for row in rows: | |
d = row.find_all('td') | |
response[d[1].text] = {'name': d[0].text, | |
'mmsi': d[1].text, | |
'call': d[2].text, | |
'imo': d[3].text, | |
'nav_status': d[4].text, | |
'cog': d[5].text, | |
'speed': d[6].text, | |
'lon': d[7].text, | |
'lat': d[8].text, | |
'length': d[9].text, | |
'width': d[10].text, | |
'draft': d[11].text, | |
'type': d[12].text, | |
'destination': d[13].text, | |
'eta': d[14].text, | |
'last_update': d[15].text} | |
print(json.dumps(response)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment