|
34 | 34 | from contextlib import contextmanager |
35 | 35 | from datetime import datetime |
36 | 36 | from functools import wraps |
37 | | -from io import BytesIO |
38 | | -from urllib import parse |
39 | 37 | from http import client |
40 | 38 | from http.cookies import SimpleCookie |
| 39 | +from io import BytesIO |
| 40 | +from urllib import parse |
41 | 41 | from xml.etree.ElementTree import XML, ParseError |
42 | | -from .data import record |
43 | | -from . import __version__ |
44 | 42 |
|
| 43 | +from splunklib.data import Record |
| 44 | + |
| 45 | +from . import __version__ |
| 46 | +from .data import record |
45 | 47 |
|
46 | 48 | logger = logging.getLogger(__name__) |
47 | 49 |
|
@@ -511,7 +513,7 @@ class Context: |
511 | 513 | :param headers: List of extra HTTP headers to send (optional). |
512 | 514 | :type headers: ``list`` of 2-tuples. |
513 | 515 | :param retries: Number of retries for each HTTP connection (optional, the default is 0). |
514 | | - NOTE: THIS MAY INCREASE THE NUMBER OF ROUNDTRIP CONNECTIONS |
| 516 | + NOTE: THIS MAY INCREASE THE NUMBER OF ROUNDTRIP CONNECTIONS |
515 | 517 | TO THE SPLUNK SERVER AND BLOCK THE CURRENT THREAD WHILE RETRYING. |
516 | 518 | :type retries: ``int`` |
517 | 519 | :param retryDelay: How long to wait between connection attempts if `retries` > 0 (optional, defaults to 10s). |
@@ -653,7 +655,9 @@ def connect(self): |
653 | 655 |
|
654 | 656 | @_authentication |
655 | 657 | @_log_duration |
656 | | - def delete(self, path_segment, owner=None, app=None, sharing=None, **query): |
| 658 | + def delete( |
| 659 | + self, path_segment, owner=None, app=None, sharing=None, **query |
| 660 | + ) -> Record: |
657 | 661 | """Performs a DELETE operation at the REST path segment with the given |
658 | 662 | namespace and query. |
659 | 663 |
|
@@ -716,7 +720,7 @@ def delete(self, path_segment, owner=None, app=None, sharing=None, **query): |
716 | 720 | @_log_duration |
717 | 721 | def get( |
718 | 722 | self, path_segment, owner=None, app=None, headers=None, sharing=None, **query |
719 | | - ): |
| 723 | + ) -> Record: |
720 | 724 | """Performs a GET operation from the REST path segment with the given |
721 | 725 | namespace and query. |
722 | 726 |
|
@@ -783,7 +787,7 @@ def get( |
783 | 787 | @_log_duration |
784 | 788 | def post( |
785 | 789 | self, path_segment, owner=None, app=None, sharing=None, headers=None, **query |
786 | | - ): |
| 790 | + ) -> Record: |
787 | 791 | """Performs a POST operation from the REST path segment with the given |
788 | 792 | namespace and query. |
789 | 793 |
|
@@ -1357,7 +1361,7 @@ def get(self, url, headers=None, **kwargs): |
1357 | 1361 | url = url + UrlEncoded("?" + _encode(**kwargs), skip_encode=True) |
1358 | 1362 | return self.request(url, {"method": "GET", "headers": headers}) |
1359 | 1363 |
|
1360 | | - def post(self, url, headers=None, **kwargs): |
| 1364 | + def post(self, url, headers=None, **kwargs) -> Record: |
1361 | 1365 | """Sends a POST request to a URL. |
1362 | 1366 |
|
1363 | 1367 | :param url: The URL. |
|
0 commit comments