MCPcopy
hub / github.com/PrefectHQ/prefect / SyncPrefectClient

Class SyncPrefectClient

src/prefect/client/orchestration/__init__.py:1228–2121  ·  view source on GitHub ↗

A synchronous client for interacting with the [Prefect REST API](https://docs.prefect.io/v3/api-ref/rest-api/). Args: api: the REST API URL or FastAPI application to connect to api_key: An optional API key for authentication. api_version: The API version this client

Source from the content-addressed store, hash-verified

1226
1227
1228class SyncPrefectClient(
1229 ArtifactClient,
1230 ArtifactCollectionClient,
1231 LogClient,
1232 VariableClient,
1233 ConcurrencyLimitClient,
1234 DeploymentClient,
1235 AutomationClient,
1236 SlaClient,
1237 FlowRunClient,
1238 FlowClient,
1239 BlocksDocumentClient,
1240 BlocksSchemaClient,
1241 BlocksTypeClient,
1242 WorkPoolClient,
1243 EventClient,
1244):
1245 """
1246 A synchronous client for interacting with the [Prefect REST API](https://docs.prefect.io/v3/api-ref/rest-api/).
1247
1248 Args:
1249 api: the REST API URL or FastAPI application to connect to
1250 api_key: An optional API key for authentication.
1251 api_version: The API version this client is compatible with.
1252 httpx_settings: An optional dictionary of settings to pass to the underlying
1253 `httpx.Client`
1254
1255 Examples:
1256
1257 Say hello to a Prefect REST API
1258
1259 ```python
1260 with get_client(sync_client=True) as client:
1261 response = client.hello()
1262
1263 print(response.json())
1264 👋
1265 ```
1266 """
1267
1268 def __init__(
1269 self,
1270 api: Union[str, ASGIApp],
1271 *,
1272 auth_string: Optional[str] = None,
1273 api_key: Optional[str] = None,
1274 api_version: Optional[str] = None,
1275 httpx_settings: Optional[dict[str, Any]] = None,
1276 server_type: Optional[ServerType] = None,
1277 ) -> None:
1278 httpx_settings = httpx_settings.copy() if httpx_settings else {}
1279 httpx_settings.setdefault("headers", {})
1280
1281 tls_verify = httpx_settings.get("verify")
1282 if not tls_verify or not isinstance(tls_verify, ssl.SSLContext):
1283 if PREFECT_API_TLS_INSECURE_SKIP_VERIFY:
1284 # Create an unverified context for insecure connections
1285 ctx = ssl.create_default_context()

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…