Skip to content

Commit d2e16c1

Browse files
committed
CRLF to LF
1 parent f11467c commit d2e16c1

File tree

8 files changed

+1729
-1736
lines changed

8 files changed

+1729
-1736
lines changed

src/vonage/__init__.py

Lines changed: 792 additions & 792 deletions
Large diffs are not rendered by default.

src/vonage/errors.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
class Error(Exception):
2-
pass
3-
4-
5-
class ClientError(Error):
6-
pass
7-
8-
9-
class ServerError(Error):
10-
pass
11-
12-
13-
class AuthenticationError(ClientError):
14-
pass
1+
class Error(Exception):
2+
pass
3+
4+
5+
class ClientError(Error):
6+
pass
7+
8+
9+
class ServerError(Error):
10+
pass
11+
12+
13+
class AuthenticationError(ClientError):
14+
pass

src/vonage/verify.py

Lines changed: 49 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,49 @@
1-
import vonage
2-
import warnings
3-
4-
class Verify:
5-
def __init__(
6-
self,
7-
client=None,
8-
key=None,
9-
secret=None
10-
):
11-
try:
12-
self._client = client
13-
if self._client is None:
14-
self._client = vonage.Client(
15-
key=key,
16-
secret=secret
17-
)
18-
except Exception as e:
19-
print('Error: {error_message}'.format(error_message=str(e)))
20-
21-
def start_verification(self, params=None, **kwargs):
22-
return self._client.post(self._client.api_host(), "/verify/json", params or kwargs)
23-
24-
def check(self, request_id, params=None, **kwargs):
25-
return self._client.post(
26-
self._client.api_host(),
27-
"/verify/check/json",
28-
dict(params or kwargs, request_id=request_id),
29-
)
30-
31-
def search(self, request_id):
32-
return self._client.get(
33-
self._client.api_host(), "/verify/search/json", {"request_id": request_id}
34-
)
35-
36-
def cancel(self, request_id):
37-
return self._client.post(
38-
self._client.api_host(),
39-
"/verify/control/json",
40-
{"request_id": request_id, "cmd": "cancel"},
41-
)
42-
43-
def trigger_next_event(self, request_id):
44-
return self._client.post(
45-
self._client.api_host(),
46-
"/verify/control/json",
47-
{"request_id": request_id, "cmd": "trigger_next_event"},
48-
)
49-
50-
def psd2(self, params=None, **kwargs):
51-
return self._client.post(self._client.api_host(), "/verify/psd2/json", params or kwargs)
1+
import vonage
2+
import warnings
3+
4+
5+
class Verify:
6+
def __init__(self, client=None, key=None, secret=None):
7+
try:
8+
self._client = client
9+
if self._client is None:
10+
self._client = vonage.Client(key=key, secret=secret)
11+
except Exception as e:
12+
print("Error: {error_message}".format(error_message=str(e)))
13+
14+
def start_verification(self, params=None, **kwargs):
15+
return self._client.post(
16+
self._client.api_host(), "/verify/json", params or kwargs
17+
)
18+
19+
def check(self, request_id, params=None, **kwargs):
20+
return self._client.post(
21+
self._client.api_host(),
22+
"/verify/check/json",
23+
dict(params or kwargs, request_id=request_id),
24+
)
25+
26+
def search(self, request_id):
27+
return self._client.get(
28+
self._client.api_host(), "/verify/search/json", {"request_id": request_id}
29+
)
30+
31+
def cancel(self, request_id):
32+
return self._client.post(
33+
self._client.api_host(),
34+
"/verify/control/json",
35+
{"request_id": request_id, "cmd": "cancel"},
36+
)
37+
38+
def trigger_next_event(self, request_id):
39+
return self._client.post(
40+
self._client.api_host(),
41+
"/verify/control/json",
42+
{"request_id": request_id, "cmd": "trigger_next_event"},
43+
)
44+
45+
def psd2(self, params=None, **kwargs):
46+
return self._client.post(
47+
self._client.api_host(), "/verify/psd2/json", params or kwargs
48+
)
49+

tests/conftest.py

Lines changed: 72 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,72 @@
1-
import os
2-
import os.path
3-
import platform
4-
5-
import pytest
6-
7-
8-
# Ensure our client isn't being configured with real values!
9-
os.environ.clear()
10-
11-
12-
def read_file(path):
13-
with open(os.path.join(os.path.dirname(__file__), path)) as input_file:
14-
return input_file.read()
15-
16-
17-
class DummyData(object):
18-
def __init__(self):
19-
import vonage
20-
21-
self.api_key = "nexmo-api-key"
22-
self.api_secret = "nexmo-api-secret"
23-
self.signature_secret = "secret"
24-
self.application_id = "nexmo-application-id"
25-
self.private_key = read_file("data/private_key.txt")
26-
self.public_key = read_file("data/public_key.txt")
27-
self.user_agent = "nexmo-python/{} python/{}".format(
28-
vonage.__version__, platform.python_version()
29-
)
30-
self.host = "rest.nexmo.com"
31-
self.api_host = "api.nexmo.com"
32-
33-
34-
@pytest.fixture(scope="session")
35-
def dummy_data():
36-
return DummyData()
37-
38-
39-
@pytest.fixture
40-
def client(dummy_data):
41-
import vonage
42-
43-
return vonage.Client(
44-
key=dummy_data.api_key,
45-
secret=dummy_data.api_secret,
46-
application_id=dummy_data.application_id,
47-
private_key=dummy_data.private_key,
48-
)
49-
50-
#Represents an instance of the Voice class for testing
51-
@pytest.fixture
52-
def voice(client, dummy_data):
53-
import vonage
54-
55-
return vonage.Voice(
56-
client
57-
)
58-
59-
#Represents an instance of the Sms class for testing
60-
@pytest.fixture
61-
def sms(client, dummy_data):
62-
import vonage
63-
64-
return vonage.Sms(
65-
client
66-
)
67-
68-
#Represents an instance of the Verify class for testing
69-
@pytest.fixture
70-
def verify(client, dummy_data):
71-
import vonage
72-
73-
return vonage.Verify(
74-
client
75-
)
1+
import os
2+
import os.path
3+
import platform
4+
5+
import pytest
6+
7+
8+
# Ensure our client isn't being configured with real values!
9+
os.environ.clear()
10+
11+
12+
def read_file(path):
13+
with open(os.path.join(os.path.dirname(__file__), path)) as input_file:
14+
return input_file.read()
15+
16+
17+
class DummyData(object):
18+
def __init__(self):
19+
import vonage
20+
21+
self.api_key = "nexmo-api-key"
22+
self.api_secret = "nexmo-api-secret"
23+
self.signature_secret = "secret"
24+
self.application_id = "nexmo-application-id"
25+
self.private_key = read_file("data/private_key.txt")
26+
self.public_key = read_file("data/public_key.txt")
27+
self.user_agent = "nexmo-python/{} python/{}".format(
28+
vonage.__version__, platform.python_version()
29+
)
30+
self.host = "rest.nexmo.com"
31+
self.api_host = "api.nexmo.com"
32+
33+
34+
@pytest.fixture(scope="session")
35+
def dummy_data():
36+
return DummyData()
37+
38+
39+
@pytest.fixture
40+
def client(dummy_data):
41+
import vonage
42+
43+
return vonage.Client(
44+
key=dummy_data.api_key,
45+
secret=dummy_data.api_secret,
46+
application_id=dummy_data.application_id,
47+
private_key=dummy_data.private_key,
48+
)
49+
50+
51+
# Represents an instance of the Voice class for testing
52+
@pytest.fixture
53+
def voice(client, dummy_data):
54+
import vonage
55+
56+
return vonage.Voice(client)
57+
58+
59+
# Represents an instance of the Sms class for testing
60+
@pytest.fixture
61+
def sms(client, dummy_data):
62+
import vonage
63+
64+
return vonage.Sms(client)
65+
66+
67+
# Represents an instance of the Verify class for testing
68+
@pytest.fixture
69+
def verify(client, dummy_data):
70+
import vonage
71+
72+
return vonage.Verify(client)

0 commit comments

Comments
 (0)