Closed ChaseAustin closed 4 years ago
@ChaseAustin
Can you try to connect directly to the EC2 instance and see if a curl works?
I am very confident that AWS's IPs are completely blacklisted.
I tried to run curl google.com
and it worked. Do you know if there is any hosting service, DigitalOcean, azure, etc. that doesn't have their IP's blacklisted?
What about a curl with the stats page? You'll need to make sure the headers line up as well.
Unfortunately, I do not know as I test everything out in my local computer. Your best bet would be to get a working proxy provider to help you connect.
Thanks, you pointed me in the right direction
Hi Chase, how did you solve this problem?
Has anyone solved this issue or found a workaround?
Easy workaround - use https://iproyal.com/ proxy.
I have a file where I call the CommonPlayerInfo endpoint and I store the data in a database. It works by calling the static player function to get the player ids needed for the common info requests. I wanted to run this file from an ec2 instance because it will take a long time to get information for every player. Locally, when I run my file, it works correctly. When I run it on my EC2 instance, on the line where I call:
player_info = commonplayerinfo.CommonPlayerInfo(player_id=person, headers=headers, timeout=20)
I get a timeout exception:
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='stats.nba.com', port=443, timeout=20)
I opened my security groups to all inbound and outbound traffic, but I'm not sure why this is still happening. The static player and team information functions work locally and on my EC2 instance.
I would appreciate any help in understanding why I can't call the API from an EC2 instance.