Skip to content

Commit

Permalink
Merge branch 'master' into add-swimlane
Browse files Browse the repository at this point in the history
  • Loading branch information
laerfulaolun committed Mar 19, 2024
2 parents 543b51b + c5be9e0 commit 48c2819
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
11 changes: 11 additions & 0 deletions automon/integrations/cryptocurrency/robinhood.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,14 @@ def __eq__(self, other):
return True
logger.debug(f'different {other}')
return False


class RobinhoodAPI(object):
summary = 'https://status.robinhood.com/api/v2/summary.json'
status = 'https://status.robinhood.com/api/v2/status.json'
components = 'https://status.robinhood.com/api/v2/components.json'
incidents_unresolved = 'https://status.robinhood.com/api/v2/incidents/unresolved.json'
incidents_all = 'https://status.robinhood.com/api/v2/incidents.json'
scheduled_maintenance_upcoming = 'https://status.robinhood.com/api/v2/scheduled-maintenances/upcoming.json'
scheduled_maintenance_active = 'https://status.robinhood.com/api/v2/scheduled-maintenances/active.json'
scheduled_maintenance_all = 'https://status.robinhood.com/api/v2/scheduled-maintenances.json'
5 changes: 3 additions & 2 deletions automon/integrations/requestsWrapper/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ class RequestsConfig(object):
def __init__(self):
pass

def is_ready(self):
def __repr__(self):
return f'{NotImplemented}'

def __repr__(self):
@property
def is_ready(self):
return f'{NotImplemented}'
16 changes: 8 additions & 8 deletions automon/integrations/requestsWrapper/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ def isConnected(self):
return True
return False

def get(self, url: str, data: str = None, headers: dict = None) -> bool:
return self.requests.get(url=url, data=data, headers=headers)
async def get(self, url: str, data: str = None, headers: dict = None) -> bool:
return await self.requests.get(url=url, data=data, headers=headers)

def post(self, url: str, data: str = None, headers: dict = None) -> bool:
return self.requests.post(url=url, data=data, headers=headers)
async def post(self, url: str, data: str = None, headers: dict = None) -> bool:
return await self.requests.post(url=url, data=data, headers=headers)

def delete(self, url: str, data: str = None, headers: dict = None) -> bool:
return self.requests.delete(url=url, data=data, headers=headers)
async def delete(self, url: str, data: str = None, headers: dict = None) -> bool:
return await self.requests.delete(url=url, data=data, headers=headers)

def patch(self, url: str, data: str = None, headers: dict = None) -> bool:
return self.requests.patch(url=url, data=data, headers=headers)
async def patch(self, url: str, data: str = None, headers: dict = None) -> bool:
return await self.requests.patch(url=url, data=data, headers=headers)

def __repr__(self):
return f'{self.__dict__}'
7 changes: 4 additions & 3 deletions automon/integrations/requestsWrapper/tests/test_requests.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import unittest

from automon.integrations.requestsWrapper import RequestsClient
Expand All @@ -8,9 +9,9 @@

class Client(unittest.TestCase):
def test_get(self):
r.get('https://1.1.1.1')
r.requests.get('https://1.1.1.1')
self.assertFalse(r.get('x://127.0.0.1'))
self.assertTrue(asyncio.run(r.get('https://1.1.1.1')))
self.assertTrue(r.requests.get('https://1.1.1.1'))
self.assertFalse(asyncio.run(r.get('x://127.0.0.1')))


class Config(unittest.TestCase):
Expand Down
7 changes: 4 additions & 3 deletions automon/integrations/requestsWrapper/tests/test_rest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import unittest

from automon.integrations.requestsWrapper.rest import BaseRestClient
Expand All @@ -7,9 +8,9 @@

class Client(unittest.TestCase):
def test_get(self):
r.get('https://1.1.1.1')
r.requests.get('https://1.1.1.1')
self.assertFalse(r.get('x://127.0.0.1'))
self.assertTrue(asyncio.run(r.get('https://1.1.1.1')))
self.assertTrue(r.requests.get('https://1.1.1.1'))
self.assertFalse(asyncio.run(r.get('x://127.0.0.1')))


if __name__ == '__main__':
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
import unittest

from automon.integrations.requestsWrapper.rest import BaseRestClient
Expand All @@ -12,7 +13,7 @@ def __init__(self):

class Client(unittest.TestCase):
def test_get(self):
Test().get(url='https://1.1.1.1')
self.assertTrue(asyncio.run(Test().get(url='https://1.1.1.1')))


if __name__ == '__main__':
Expand Down

0 comments on commit 48c2819

Please sign in to comment.