Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
1cae6e66
Commit
1cae6e66
authored
5 years ago
by
Malte Franken
Committed by
cgtobi
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
move imports to top-level (#27630)
parent
b7023a96
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
homeassistant/components/pushover/notify.py
+2
-8
2 additions, 8 deletions
homeassistant/components/pushover/notify.py
with
2 additions
and
8 deletions
homeassistant/components/pushover/notify.py
+
2
−
8
View file @
1cae6e66
"""
Pushover platform for notify component.
"""
import
logging
import
requests
import
voluptuous
as
vol
from
pushover
import
InitError
,
Client
,
RequestError
from
homeassistant.const
import
CONF_API_KEY
import
homeassistant.helpers.config_validation
as
cv
...
...
@@ -28,8 +30,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
def
get_service
(
hass
,
config
,
discovery_info
=
None
):
"""
Get the Pushover notification service.
"""
from
pushover
import
InitError
try
:
return
PushoverNotificationService
(
hass
,
config
[
CONF_USER_KEY
],
config
[
CONF_API_KEY
]
...
...
@@ -44,8 +44,6 @@ class PushoverNotificationService(BaseNotificationService):
def
__init__
(
self
,
hass
,
user_key
,
api_token
):
"""
Initialize the service.
"""
from
pushover
import
Client
self
.
_hass
=
hass
self
.
_user_key
=
user_key
self
.
_api_token
=
api_token
...
...
@@ -53,8 +51,6 @@ class PushoverNotificationService(BaseNotificationService):
def
send_message
(
self
,
message
=
""
,
**
kwargs
):
"""
Send a message to a user.
"""
from
pushover
import
RequestError
# Make a copy and use empty dict if necessary
data
=
dict
(
kwargs
.
get
(
ATTR_DATA
)
or
{})
...
...
@@ -65,8 +61,6 @@ class PushoverNotificationService(BaseNotificationService):
# If attachment is a URL, use requests to open it as a stream.
if
data
[
ATTR_ATTACHMENT
].
startswith
(
"
http
"
):
try
:
import
requests
response
=
requests
.
get
(
data
[
ATTR_ATTACHMENT
],
stream
=
True
,
timeout
=
5
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment