OneSignal / onesignal-python-api

Other
12 stars 6 forks source link

[Bug]: export_events fail because of invalid url #32

Open vintersnow opened 4 months ago

vintersnow commented 4 months ago

What happened?

I tried to call the export_events endpoint, and an error occurs.

Steps to reproduce?

import onesignal
from onesignal.api import default_api
from pprint import pprint

app_id = "" # The ID of the app that the notification belongs to. 
notification_id = "" # The ID of the notification to export events from. 
app_key = ""
configuration = onesignal.Configuration(
    app_key = app_key,
)

with onesignal.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = default_api.DefaultApi(api_client)

    # example passing only required values which don't have defaults set
    try:
        # Export CSV of Events
        api_response = api_instance.export_events(notification_id, app_id)
        pprint(api_response)
    except onesignal.ApiException as e:
        print("Exception when calling DefaultApi->export_events: %s\n" % e)

Then below error happen

xception when calling DefaultApi->export_events: Status Code: 400
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'Date': 'Thu, 22 Feb 2024 08:57:21 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Transfer-Encoding': 'chunked', 'Connection': 'keep-alive', 'x-runtime': '0.002893', 'x-frame-options': 'SAMEORIGIN', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff', 'x-download-options': 'noopen', 'x-permitted-cross-domain-policies': 'none', 'referrer-policy': 'strict-origin-when-cross-origin', 'vary': 'Accept, Origin', 'cache-control': 'no-cache', 'x-request-id': '24318108-c138-4520-bf22-0e84df5d69b9', 'Via': '1.1 google', 'Alt-Svc': 'h3=":443"; ma=86400', 'CF-Cache-Status': 'DYNAMIC', 'Set-Cookie': '__cf_bm=VSykhFk5JQx4HQvlhEMUvUFmajyxkI.NtRLfAprxPfA-1708592241-1.0-AfV/2RSdnw2A11iY6ZRNMoGTvqYRDSETTQcEgm7f4BqhcYCXXkwujUGhh8J+4CvUdb2fS68dKJ5wAbswEC5RmIo=; path=/; expires=Thu, 22-Feb-24 09:27:21 GMT; domain=.onesignal.com; HttpOnly; Secure; SameSite=None', 'Strict-Transport-Security': 'max-age=15552000; includeSubDomains', 'Server': 'cloudflare', 'CF-RAY': '85960563e8ad7378-NRT'})
HTTP response body: {"errors":["Invalid app_id format"]}

What did you expect to happen?

Success to call the endpoint

Relevant log output

No response

Code of Conduct