Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated SATNOGSs db fetch script to work under Python 3 #101

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
8 changes: 4 additions & 4 deletions utils/fetch_satnogs_db.py.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python

#This is a script that fetches transponder data from db.satnogs.org and parses it to flyby transponder data.
import urllib2
import json
import sys
import tempfile
from urllib.request import urlopen
from distutils import spawn
from subprocess import call
from operator import itemgetter
Expand All @@ -21,16 +21,16 @@ else:
sys.exit();

#Step 1: Fetch JSON transponder information from SatNOGS db.
request = urllib2.urlopen("https://db.satnogs.org/api/transmitters")
request = urlopen("https://db.satnogs.org/api/transmitters")
data = json.load(request)

# Order data by norad_cat_id entry
sorteddata = sorted(data, key=itemgetter('norad_cat_id'))
sorteddata = sorted(data, key=lambda x: x['norad_cat_id'] or 0)

# Open output file
db = None;
if not named_file:
db = tempfile.NamedTemporaryFile();
db = tempfile.NamedTemporaryFile(mode='w+t')
else:
db = open(named_file, "w");

Expand Down