fix(ci): fix black/ruff failures, add CoC and PR template
- Fix Python formatting (sync no longer strips blank lines from .py files) - Remove test_community_build.py (tests private sync module) - Fix ruff warnings in test files - Add CODE_OF_CONDUCT.md - Add .github/PULL_REQUEST_TEMPLATE.md Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,7 @@ from dotenv import load_dotenv
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
|
||||
|
||||
# Example 1: List Posts
|
||||
async def list_posts_example():
|
||||
"""List published posts from a WordPress site."""
|
||||
@@ -39,6 +40,7 @@ async def list_posts_example():
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
|
||||
# Example 2: Create a Post
|
||||
async def create_post_example():
|
||||
"""Create a new WordPress post."""
|
||||
@@ -78,6 +80,7 @@ async def create_post_example():
|
||||
print(f"Error: {e}")
|
||||
return None
|
||||
|
||||
|
||||
# Example 3: Update a Post
|
||||
async def update_post_example(post_id):
|
||||
"""Update an existing WordPress post."""
|
||||
@@ -118,6 +121,7 @@ async def update_post_example(post_id):
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
|
||||
# Example 4: List Categories
|
||||
async def list_categories_example():
|
||||
"""List WordPress categories."""
|
||||
@@ -141,6 +145,7 @@ async def list_categories_example():
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
|
||||
# Example 5: Upload Media
|
||||
async def upload_media_example():
|
||||
"""Upload media from URL to WordPress."""
|
||||
@@ -178,6 +183,7 @@ async def upload_media_example():
|
||||
print(f"Error: {e}")
|
||||
return None
|
||||
|
||||
|
||||
# Example 6: Get Site Health
|
||||
async def site_health_example():
|
||||
"""Check WordPress site health."""
|
||||
@@ -200,6 +206,7 @@ async def site_health_example():
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
|
||||
# Example 7: Get System Metrics
|
||||
async def system_metrics_example():
|
||||
"""Check MCP server health and metrics."""
|
||||
@@ -224,6 +231,7 @@ async def system_metrics_example():
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
|
||||
# Example 8: Delete Post
|
||||
async def delete_post_example(post_id):
|
||||
"""Delete a WordPress post."""
|
||||
@@ -257,6 +265,7 @@ async def delete_post_example(post_id):
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
|
||||
# Main execution
|
||||
async def main():
|
||||
"""Run all examples in sequence."""
|
||||
@@ -289,5 +298,6 @@ async def main():
|
||||
print("Examples completed successfully!")
|
||||
print("=" * 60 + "\n")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
|
||||
Reference in New Issue
Block a user