Skip to content

Commit

Permalink
Restoring the HOST variable
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasmiller committed Jan 31, 2022
1 parent 7dd2ba1 commit 01f3726
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ api_key = '83749879bbde395b5fe0cc1a5abf8e5'
client = recurly.Client(api_key)
```

To access Recurly servers in Europe you have to initialize the client with the argument region with the value "eu".
To access Recurly API in Europe, you will need to specify the EU Region in the argument region.

```python
api_key = '83749879bbde395b5fe0cc1a5abf8e5'
Expand Down
6 changes: 4 additions & 2 deletions recurly/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import socket
from base64 import b64encode
import json
import ssl
from . import resources
from .resource import Resource, Empty
from .request import Request
Expand All @@ -16,6 +17,7 @@
BINARY_TYPES = ["application/pdf"]
ALLOWED_OPTIONS = ["body", "params", "headers"]
API_HOSTS = {"us": "v3.recurly.com", "eu": "v3.eu.recurly.com"}
HOST = API_HOSTS["us"]


def request_converter(value):
Expand All @@ -30,7 +32,7 @@ class BaseClient:
def __init__(self, api_key, timeout=None, **options):
self.__api_key = api_key
actual_timeout = timeout if timeout is not None else DEFAULT_REQUEST_TIMEOUT
api_host = API_HOSTS["us"]
api_host = HOST

if "region" in options:
if options["region"] not in API_HOSTS:
Expand All @@ -42,7 +44,7 @@ def __init__(self, api_key, timeout=None, **options):
api_host = API_HOSTS[options["region"]]

self.__conn = http.client.HTTPSConnection(
api_host, PORT, timeout=actual_timeout
api_host, PORT, timeout=actual_timeout, context=ssl.create_default_context()
)

def _make_request(self, method, path, body, **options):
Expand Down

0 comments on commit 01f3726

Please sign in to comment.