OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Making an API call, but erverytime it runs - it gives a new result

  • Thread starter Thread starter Mathias Eriksen
  • Start date Start date
M

Mathias Eriksen

Guest
I have a simple requests() code for an API on this page: https://www.sofascore.com/api/v1/event/11988745/votes

My Python code is:

Code:
import requests

url = "https://www.sofascore.com/api/v1/event/11988745/votes"

response = requests.get(url)
data = response.json()
print(data)

However, every time I run the script it returns a different result each time:


  1. 'vote': {'vote1': 500, 'vote2': 120, 'voteX': 414}, 'bothTeamsToScoreVote': {'voteYes': 12, 'voteNo': 8}, 'firstTeamToScoreVote': {'voteHome': 60, 'voteNoGoal': 0, 'voteAway': 8}, 'whoShouldHaveWonVote': {'vote1': 0, 'vote2': 0}}


  2. {'vote': {'vote1': 198, 'vote2': 48, 'voteX': 150}, 'bothTeamsToScoreVote': {'voteYes': 148, 'voteNo': 4}, 'firstTeamToScoreVote': {'voteHome': 70, 'voteNoGoal': 2, 'voteAway': 12}, 'whoShouldHaveWonVote': {'vote1': 0, 'vote2': 0}}


  3. {'vote': {'vote1': 214, 'vote2': 32, 'voteX': 110}, 'bothTeamsToScoreVote': {'voteYes': 52, 'voteNo': 2}, 'firstTeamToScoreVote': {'voteHome': 42, 'voteNoGoal': 0, 'voteAway': 0}, 'whoShouldHaveWonVote': {'vote1': 0, 'vote2': 0}}

When I am looking at the url I get this result:

Code:
{"vote":{"vote1":386,"vote2":86,"voteX":269},"bothTeamsToScoreVote":{"voteYes":90,"voteNo":9},"firstTeamToScoreVote":{"voteHome":37,"voteNoGoal":5,"voteAway":9},"whoShouldHaveWonVote":{"vote1":0,"vote2":0}}

Can anybody help me do this correct or am I missing something?
<p>I have a simple requests() code for an API on this page: <a href="https://www.sofascore.com/api/v1/event/11988745/votes" rel="nofollow noreferrer">https://www.sofascore.com/api/v1/event/11988745/votes</a></p>
<p>My Python code is:</p>
<pre><code>import requests

url = "https://www.sofascore.com/api/v1/event/11988745/votes"

response = requests.get(url)
data = response.json()
print(data)
</code></pre>
<p>However, every time I run the script it returns a different result each time:</p>
<ol>
<li><p><code>'vote': {'vote1': 500, 'vote2': 120, 'voteX': 414}, 'bothTeamsToScoreVote': {'voteYes': 12, 'voteNo': 8}, 'firstTeamToScoreVote': {'voteHome': 60, 'voteNoGoal': 0, 'voteAway': 8}, 'whoShouldHaveWonVote': {'vote1': 0, 'vote2': 0}}</code></p>
</li>
<li><p><code>{'vote': {'vote1': 198, 'vote2': 48, 'voteX': 150}, 'bothTeamsToScoreVote': {'voteYes': 148, 'voteNo': 4}, 'firstTeamToScoreVote': {'voteHome': 70, 'voteNoGoal': 2, 'voteAway': 12}, 'whoShouldHaveWonVote': {'vote1': 0, 'vote2': 0}}</code></p>
</li>
<li><p><code>{'vote': {'vote1': 214, 'vote2': 32, 'voteX': 110}, 'bothTeamsToScoreVote': {'voteYes': 52, 'voteNo': 2}, 'firstTeamToScoreVote': {'voteHome': 42, 'voteNoGoal': 0, 'voteAway': 0}, 'whoShouldHaveWonVote': {'vote1': 0, 'vote2': 0}}</code></p>
</li>
</ol>
<p>When I am looking at the url I get this result:</p>
<pre><code>{"vote":{"vote1":386,"vote2":86,"voteX":269},"bothTeamsToScoreVote":{"voteYes":90,"voteNo":9},"firstTeamToScoreVote":{"voteHome":37,"voteNoGoal":5,"voteAway":9},"whoShouldHaveWonVote":{"vote1":0,"vote2":0}}
</code></pre>
<p>Can anybody help me do this correct or am I missing something?</p>
 
Top