Created
October 30, 2024 22:10
-
-
Save j2kun/a8f5c5a8d3d56b1f1bb98e948254a944 to your computer and use it in GitHub Desktop.
Revisions
-
j2kun created this gist
Oct 30, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ import indieweb_utils def send_webmention(source_url, target_url, dry_run=False): print(f"Found a webmention: {source_url} -> {target_url}") try: indieweb_utils.discover_webmention_endpoint(source_url) except Exception as e: print(f"Error discovering webmention endpoint: {e}") return if dry_run: print("Dry run enabled, skipping webmention") return try: response = indieweb_utils.send_webmention(source_url, target_url) except indieweb_utils.webmentions.discovery.WebmentionEndpointNotFound: print("Webmention endpoint not found.") return except Exception as e: print(f"Webmention error: {e}") return print(response) print("Webmention sent!")