|
1 | | -from scrapegraph_py import SyncClient |
2 | | -from scrapegraph_py.logger import get_logger |
3 | | - |
4 | | -get_logger(level="DEBUG") |
5 | | - |
6 | | -# Initialize the client |
7 | | -sgai_client = SyncClient(api_key="your-api-key-here") |
8 | | - |
9 | | -# Example request_id (replace with an actual request_id from a previous request) |
10 | | -request_id = "your-request-id-here" |
11 | | - |
12 | | -# Check remaining credits |
13 | | -credits = sgai_client.get_credits() |
14 | | -print(f"Credits Info: {credits}") |
15 | | - |
16 | | -# Submit feedback for a previous request |
17 | | -feedback_response = sgai_client.submit_feedback( |
18 | | - request_id=request_id, |
19 | | - rating=5, # Rating from 1-5 |
20 | | - feedback_text="The extraction was accurate and exactly what I needed!", |
21 | | -) |
22 | | -print(f"\nFeedback Response: {feedback_response}") |
23 | | - |
24 | | -# Get previous results using get_smartscraper |
25 | | -previous_result = sgai_client.get_smartscraper(request_id=request_id) |
26 | | -print(f"\nRetrieved Previous Result: {previous_result}") |
27 | | - |
28 | | -sgai_client.close() |
| 1 | +from scrapegraph_py import SyncClient |
| 2 | +from scrapegraph_py.logger import get_logger |
| 3 | + |
| 4 | +get_logger(level="DEBUG") |
| 5 | + |
| 6 | +# Initialize the client |
| 7 | +sgai_client = SyncClient(api_key="your-api-key-here") |
| 8 | + |
| 9 | +# Example request_id (replace with an actual request_id from a previous request) |
| 10 | +request_id = "your-request-id-here" |
| 11 | + |
| 12 | +# Submit feedback for a previous request |
| 13 | +feedback_response = sgai_client.submit_feedback( |
| 14 | + request_id=request_id, |
| 15 | + rating=5, # Rating from 1-5 |
| 16 | + feedback_text="The extraction was accurate and exactly what I needed!", |
| 17 | +) |
| 18 | +print(f"\nFeedback Response: {feedback_response}") |
| 19 | + |
| 20 | +# Get previous results using get_smartscraper |
| 21 | +previous_result = sgai_client.get_smartscraper(request_id=request_id) |
| 22 | +print(f"\nRetrieved Previous Result: {previous_result}") |
| 23 | + |
| 24 | +sgai_client.close() |
0 commit comments