MCPcopy Index your code
hub / github.com/omkarcloud/botasaurus / create_async_task

Method create_async_task

botasaurus_api/botasaurus_api/__init__.py:68–85  ·  view source on GitHub ↗

Submits an asynchronous task to the server. :param data: The data to be processed by the task. :param scraper_name: The name of the scraper to use for the task. If not provided, the server will use the default scraper. :return: The created task object.

(self, data, scraper_name=None)

Source from the content-addressed store, hash-verified

66api = Api('https://example.com')""".format(self._api_url))
67
68 def create_async_task(self, data, scraper_name=None):
69 """
70 Submits an asynchronous task to the server.
71
72 :param data: The data to be processed by the task.
73 :param scraper_name: The name of the scraper to use for the task. If not provided, the server will use the default scraper.
74 :return: The created task object.
75 """
76 url = self._make_api_url("api/tasks/create-task-async")
77 payload = {
78 "data": data,
79 "scraper_name": scraper_name,
80 }
81 response = requests.post(url, json=payload)
82 _raise_for_status(response)
83 response_data = response.json()
84 self._write_json("create_async_task", response_data) # Call write_json with method name
85 return response_data
86
87 def create_sync_task(self, data, scraper_name=None):
88 """

Callers

nothing calls this directly

Calls 3

_make_api_urlMethod · 0.95
_write_jsonMethod · 0.95
_raise_for_statusFunction · 0.85

Tested by

no test coverage detected