1

I got the following page from Veikkaus: https://www.veikkaus.fi/fi/vedonlyonti/pitkaveto which loads an EventStream (Serve Side Events (SSE)) to retrieve data from the server. See the picture below

EventStream

I'm trying to reproduce this EventStream in Postman, however when I perform the action copy as CURL on the network request and import it in Postman then nothing is returned by the EventStream.

I furthermore tried to debug it using Python but this yields the same results, the code I used is show below (the URL is dynamic).

import requests
from sseclient import SSEClient

# URL of the SSE endpoint
sse_url = "https://api-fip.sbtech.com/veikkaus/sportsdata/v2/stream/events?query=%24filter%3Did%20eq%20%2729185250%27&locale=fi&initialData=true&includeMarkets=all&jwt=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE2OTE1MjQ1NjEsImlzcyI6IlZlaWtrYXVzIiwiU2l0ZUlkIjozNTksIklzQW5vbnltb3VzIjp0cnVlLCJTZXNzaW9uSWQiOiI5MTNkZjc2My02ODdmLTQzOWUtYmZhYy01YjVkODg3NjM4NWQiLCJuYmYiOjE2OTE1MTczNjEsImlhdCI6MTY5MTUxNzM2MX0.aARFZpjCI-4PAX9UHVE6P5fb_g2eRn8N3DAcX7xIS_DYDSU4yCk3eWYHuDsPd3dCTTskTsYg39_bw0VOOqNj-vln8EWYsCVDe5nH0aqudWSm-ly9YZ6ecA9Bb014OJbS4oBl1l11DTyoEVXdpK6wZLwikcdCyQyqPZGO0qz4RhQbG91KnGSzv64BbEcyWop6f0-DE6rjPthwhi2w0OXaYSIhFLL83STLP_EHmd6VadXLCk5fvBWcRDeApy-gIkLzlD8XwFcMXQj02YL2jV1DNe2_VUz7Qzb4mJjpoy3iuZGjGQbHKhQzTOrjr8MmJAKY_2_GXt8AEY-MSf3kU7VozA"

headers = {
  'authority': 'api-fip.sbtech.com',
  'accept': 'text/event-stream',
  'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
  'cache-control': 'no-cache',
  'origin': 'https://www.veikkaus.fi',
  'referer': 'https://www.veikkaus.fi/',
  'sec-ch-ua': '"Not/A)Brand";v="99", "Google Chrome";v="115", "Chromium";v="115"',
  'sec-ch-ua-mobile': '?0',
  'sec-ch-ua-platform': '"macOS"',
  'sec-fetch-dest': 'empty',
  'sec-fetch-mode': 'cors',
  'sec-fetch-site': 'cross-site',
  'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36',
  'Cookie': 'lb_sess=c76e48e72ae4aee2c9c3031bc3f7ede4'
}

# Make a GET request to establish the SSE connection
response = requests.get(sse_url, headers=headers, stream=True)

print(response.status_code)

if response.status_code == 200:
    # Create an SSE client
    sse_client = SSEClient(response.content)

    # Iterate through SSE events
    for event in sse_client:
        print("Received update:", event.data)
else:
    print("Failed to establish SSE connection.")

What am I doing wrong?

Sander Bakker
  • 435
  • 1
  • 4
  • 14

0 Answers0