Merge pull request #46 from modelcontextprotocol/davidsp/fix-docs

docs: fix requests.HTTPError -> httpx.HTTPError
This commit is contained in:
Justin Spahr-Summers 2024-11-26 08:17:59 -06:00 • committed by GitHub
commit f02570cb6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -247,7 +247,7 @@ Let's build your first MCP server in Python! We'll create a weather server that
text=json.dumps(forecasts, indent=2)
)
]
except requests.HTTPError as e:
except httpx.HTTPError as e:
logger.error(f"Weather API error: {str(e)}")
raise RuntimeError(f"Weather API error: {str(e)}")
```
@ -448,7 +448,7 @@ Let's build your first MCP server in Python! We'll create a weather server that
async with httpx.AsyncClient() as client:
response = await client.get(..., params={..., **http_params})
response.raise_for_status()
except requests.HTTPError as e:
except httpx.HTTPError as e:
raise McpError(
ErrorCode.INTERNAL_ERROR,
f"API error: {str(e)}"