Fix invalid escape sequence warnings by updating asterisk-ami dependency #115
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR resolves the SyntaxWarning messages about invalid escape sequences that users were experiencing when using the Asterisk integration with Python 3.13+.
Problem
Users reported seeing warnings like:
Root Cause
The issue was caused by the asterisk-ami dependency being pinned to version 0.1.6 in
manifest.json
, which contained regex patterns with invalid escape sequences:Solution
Updated the asterisk-ami dependency requirement from
==0.1.6
to>=0.1.7
. The upstream asterisk-ami library already fixed these warnings in version 0.1.7 (released January 2024) by using raw string literals:Changes Made
custom_components/asterisk/manifest.json
to requireasterisk-ami>=0.1.7
dev-requirements.txt
to useasterisk-ami>=0.1.7
for consistencyThis is a minimal change that leverages the existing upstream fix without modifying any of the integration's code. Users will automatically receive the corrected version when Home Assistant installs the integration's dependencies.
Fixes #114.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
https://api.github.com/search/repositories
import requests
import json
try:
# Check GitHub for asterisk-ami project
response = requests.get('REDACTED', timeout=10)
if response.status_code == 200:
repos = response.json()['items']
for repo in repos[:3]:
print(f'Repo: {repo["full_name"]} - {repo["description"]}')
print(f'URL: {repo["html_url"]}')
print('---')
else:
print('Could not fetch from GitHub API')
except Exception as e:
print(f'Error: {e}')` (http block)
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.