Skip to content

Documentation incorrect for EU and Enterprise customers #224

Open
@nathancatania

Description

@nathancatania

Putting this out there in case other people come across this issue.

Problem

The current documentation for EU and Enterprise customers is incorrect:

For SparkPost EU and Enterprise accounts, pass in a second parameter to set the API host.

from sparkpost import SparkPost
sp = SparkPost('YOUR API KEY', 'https://api.eu.sparkpost.com')

This causes a resolver error:

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='https', port=443): Max retries exceeded with url: //api.eu.sparkpost.com/api/v1/transmissions (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fe226f75630>: Failed to establish a new connection: [Errno -2] Name or service not known'))

Cause

When the second parameter is passed, the constructor appends "https://" to the string (assuming that a domain will be passed and NOT the base URL). This causes the resultant URL to be https://https://api.eu.sparkpost.com/api/v1/transmissions, which causes connectivity failure.

Solution

When passing the API host, drop the https://. Working example:

from sparkpost import SparkPost
sp = SparkPost('YOUR API KEY', 'api.eu.sparkpost.com')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions