3
3
import pytest
4
4
import responses
5
5
6
- from scrapegraph_py .client import SyncClient
6
+ from scrapegraph_py .client import Client
7
7
from tests .utils import generate_mock_api_key
8
8
9
9
@@ -30,7 +30,7 @@ def test_smartscraper(mock_api_key):
30
30
},
31
31
)
32
32
33
- with SyncClient (api_key = mock_api_key ) as client :
33
+ with Client (api_key = mock_api_key ) as client :
34
34
response = client .smartscraper (
35
35
website_url = "https://example.com" , user_prompt = "Describe this page."
36
36
)
@@ -49,7 +49,7 @@ def test_get_smartscraper(mock_api_key, mock_uuid):
49
49
},
50
50
)
51
51
52
- with SyncClient (api_key = mock_api_key ) as client :
52
+ with Client (api_key = mock_api_key ) as client :
53
53
response = client .get_smartscraper (mock_uuid )
54
54
assert response ["status" ] == "completed"
55
55
assert response ["request_id" ] == mock_uuid
@@ -63,7 +63,7 @@ def test_get_credits(mock_api_key):
63
63
json = {"remaining_credits" : 100 , "total_credits_used" : 50 },
64
64
)
65
65
66
- with SyncClient (api_key = mock_api_key ) as client :
66
+ with Client (api_key = mock_api_key ) as client :
67
67
response = client .get_credits ()
68
68
assert response ["remaining_credits" ] == 100
69
69
assert response ["total_credits_used" ] == 50
@@ -77,7 +77,7 @@ def test_submit_feedback(mock_api_key):
77
77
json = {"status" : "success" },
78
78
)
79
79
80
- with SyncClient (api_key = mock_api_key ) as client :
80
+ with Client (api_key = mock_api_key ) as client :
81
81
response = client .submit_feedback (
82
82
request_id = str (uuid4 ()), rating = 5 , feedback_text = "Great service!"
83
83
)
@@ -92,7 +92,7 @@ def test_network_error(mock_api_key):
92
92
body = ConnectionError ("Network error" ),
93
93
)
94
94
95
- with SyncClient (api_key = mock_api_key ) as client :
95
+ with Client (api_key = mock_api_key ) as client :
96
96
with pytest .raises (ConnectionError ):
97
97
client .smartscraper (
98
98
website_url = "https://example.com" , user_prompt = "Describe this page."
0 commit comments