Skip to content

Commit

Permalink
Merge pull request #123 from natekspencer/dev
Browse files Browse the repository at this point in the history
Update grpc endpoint from beam
  • Loading branch information
natekspencer authored Nov 20, 2023
2 parents 34abed7 + cba4718 commit d0aeb55
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ permissions:
contents: read

jobs:
build:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build and publish to pypi
uses: JRubics/[email protected]
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
plugins: "poetry-dynamic-versioning-plugin"
plugins: "poetry-dynamic-versioning[plugin]"
10 changes: 6 additions & 4 deletions vivintpy/vivintskyapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
_LOGGER = logging.getLogger(__name__)

API_ENDPOINT = "https://www.vivintsky.com/api"
BEAM_ENDPOINT = "beam.vivintsky.com:443"
GRPC_ENDPOINT = "grpc.vivintsky.com:50051"
MFA_ENDPOINT = (
"https://www.vivintsky.com/platform-user-api/v0/platformusers/2fa/validate"
)
Expand Down Expand Up @@ -186,7 +186,7 @@ async def set_camera_as_doorbell_chime_extender(
creds = grpc.ssl_channel_credentials()
assert (cookie := self._get_session_cookie())

async with grpc.aio.secure_channel(BEAM_ENDPOINT, credentials=creds) as channel:
async with grpc.aio.secure_channel(GRPC_ENDPOINT, credentials=creds) as channel:
stub: beam_pb2_grpc.BeamStub = beam_pb2_grpc.BeamStub(channel) # type: ignore
response: beam_pb2.SetUseAsDoorbellChimeExtenderResponse = await stub.SetUseAsDoorbellChimeExtender(
beam_pb2.SetUseAsDoorbellChimeExtenderRequest( # pylint: disable=no-member
Expand All @@ -206,7 +206,7 @@ async def set_camera_privacy_mode(
creds = grpc.ssl_channel_credentials()
assert (cookie := self._get_session_cookie())

async with grpc.aio.secure_channel(BEAM_ENDPOINT, credentials=creds) as channel:
async with grpc.aio.secure_channel(GRPC_ENDPOINT, credentials=creds) as channel:
stub: beam_pb2_grpc.BeamStub = beam_pb2_grpc.BeamStub(channel) # type: ignore
response: beam_pb2.SetCameraPrivacyModeResponse = (
await stub.SetCameraPrivacyMode(
Expand All @@ -228,7 +228,7 @@ async def set_camera_deter_mode(
creds = grpc.ssl_channel_credentials()
assert (cookie := self._get_session_cookie())

async with grpc.aio.secure_channel(BEAM_ENDPOINT, credentials=creds) as channel:
async with grpc.aio.secure_channel(GRPC_ENDPOINT, credentials=creds) as channel:
stub: beam_pb2_grpc.BeamStub = beam_pb2_grpc.BeamStub(channel) # type: ignore
response: beam_pb2.SetDeterOverrideResponse = await stub.SetDeterOverride(
beam_pb2.SetDeterOverrideRequest( # pylint: disable=no-member
Expand Down Expand Up @@ -506,6 +506,8 @@ async def __call(
allow_redirects=allow_redirects,
)
async with resp:
if not resp.ok and resp.content_type != "application/json":
resp.raise_for_status()
resp_data: dict = await resp.json(encoding="utf-8")
if resp.status == 200:
return resp_data
Expand Down

0 comments on commit d0aeb55

Please sign in to comment.