0

I just got an ESPN API key, and have just started to try to use it. However, when I try to call it, I get a 403 error, which means the servers think I have already called the data too many times today. To clarify, my limit is 7,500 calls per day. My code is extremely simple, just seeing what data comes back:

import requests
print(requests.get('http://api.espn.com/:version/sports?apikey=:apikey'))

The API key is correct, and for extra detail I am using the Spyder API.

JAL
  • 41,701
  • 23
  • 172
  • 300
GNP284
  • 31
  • 6

1 Answers1

0

This is my working solution:

Python 2.7.5 (default, Mar  9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> version = 'v1'
>>> apikey = '[YOUR KEY HERE]'
>>> print(requests.get('http://api.espn.com/' + version + '/sports?apikey=' + apikey))
<Response [200]>
>>>

This also works:

Python 2.7.5 (default, Mar  9 2014, 22:15:05)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> url = 'http://api.espn.com/v1/sports'
>>> params = dict(
...     apikey = '[YOUR KEY HERE]'
... )
>>> print(requests.get(url=url, params=params))
<Response [200]>
>>>
JAL
  • 41,701
  • 23
  • 172
  • 300