API + Python Issue

34 views
Skip to first unread message

Phil Lopreiato

unread,
Mar 9, 2016, 2:54:27 PM3/9/16
to theblueallian...@googlegroups.com
I've been helping someone debug an issue with accessing the API through python

"I am running Python 2.7.5 on WinXP Pro SP3 machine. Unfortunately, I can't change the Python installation on that machine right now.

I don't know enough about Python to understand why, but the following FRC API script works fine:
from urllib2 import Request, urlopen

fsuffix="m.xml";
URLprefix="https://frc-api.firstinspires.org/api/v1.0/matches/2016/"
URLsuffix="?tournamentLevel=qual"

headers = {'Accept': 'application/xml', 'Authorization': 'Basic [redacted]'}

def get_data(event):
	fname=event+fsuffix
	URL =  URLprefix + event + URLsuffix
	request = Request(URL, headers=headers)
	data = urlopen(request).read()
	f = open(fname,'w')
	f.write(data)
	f.close()

get_data("SCMB")

"

However, running this script:
https://gist.github.com/phil-lopreia...ad6e8d5d32d4b3

causes these errors:

Traceback (most recent call last):

  File "z.py", line 18, in <module>

    result = fetch_endpoint('event/{}'.format(event_key))

  File "z.py", line 12, in fetch_endpoint

    response = urllib2.urlopen(url)

  File "K:\PYTHON27\lib\urllib2.py", line 127, in urlopen

    return _opener.open(url, data, timeout)

  File "K:\PYTHON27\lib\urllib2.py", line 404, in open

    response = self._open(req, data)

  File "K:\PYTHON27\lib\urllib2.py", line 422, in _open

    '_open', req)

  File "K:\PYTHON27\lib\urllib2.py", line 382, in _call_chain

    result = func(*args)

  File "K:\PYTHON27\lib\urllib2.py", line 1222, in https_open

    return self.do_open(httplib.HTTPSConnection, req)

  File "K:\PYTHON27\lib\urllib2.py", line 1184, in do_open

    raise URLError(err)

urllib2.URLError: <urlopen error [Errno 1] _ssl.c:504: 
error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal 
error>.
			
		


Does anybody have any idea what the issue could be?

Phil
--



Phil Lopreiato

Phil Lopreiato

unread,
Mar 9, 2016, 2:57:09 PM3/9/16
to thebluealliance-developers
Here's the actual URL of the second script: https://gist.github.com/phil-lopreiato/b8c346ad6e8d5d32d4b3

Eugene Fang

unread,
Mar 9, 2016, 3:01:32 PM3/9/16
to theblueallian...@googlegroups.com
Have you tried non SSL versions of the TBA API? CloudFlare's free SSL certificates use SNI ECDSA (Don't ask me what that means -- Google it), which don't always work on older systems.

--
You received this message because you are subscribed to the Google Groups "thebluealliance-developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to thebluealliance-dev...@googlegroups.com.
To post to this group, send email to theblueallian...@googlegroups.com.
Visit this group at https://groups.google.com/group/thebluealliance-developers.
For more options, visit https://groups.google.com/d/optout.

Phil Lopreiato

unread,
Mar 9, 2016, 3:41:40 PM3/9/16
to thebluealliance-developers
Update: this resolved the issue.

Thanks Eugene!
To unsubscribe from this group and stop receiving emails from it, send an email to thebluealliance-developers+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages