Skip to content

Instantly share code, notes, and snippets.

@mfin
Created January 17, 2017 19:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfin/397321c2acfd26542476c63f5c64ea2c to your computer and use it in GitHub Desktop.
Save mfin/397321c2acfd26542476c63f5c64ea2c to your computer and use it in GitHub Desktop.
Gulf of Trieste AIS vessel positioning
#!/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