Skip to content

Commit

Permalink
make it py2 and py3 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
digizeph committed Jul 18, 2019
1 parent e69d78b commit ba7a207
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/spark-recordcount.py
Expand Up @@ -37,7 +37,10 @@
from pyspark import SparkConf, SparkContext
from _pybgpstream import BGPStream, BGPRecord
import sys
import urllib.request, urllib.error, urllib.parse
try:
import urllib.request as urllib_request
except:
import urllib2 as urllib_request

# Output one data point per day
RESULT_GRANULARITY = 3600*24
Expand All @@ -56,7 +59,7 @@

# Query the BGPStream broker and identify the collectors that are available
def get_collectors():
response = urllib.request.urlopen(COLLECTORS_URL)
response = urllib_request.urlopen(COLLECTORS_URL)
data = json.load(response)
results = []
for coll in data['data']['collectors']:
Expand Down

0 comments on commit ba7a207

Please sign in to comment.