Skip to content

Commit

Permalink
helper to get all data
Browse files Browse the repository at this point in the history
  • Loading branch information
daroczig committed Dec 28, 2023
1 parent f2fcffd commit 990a143
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ Examples:

```py
from sc_crawler.vendors import aws
aws.get_datacenters()
aws.get_all() # slow to query all instance types in all regions
aws.datacenters
aws.zones

from rich import print as pp
pp(aws)
pp(aws._datacenters[1]._zones)
pp(aws._servers.get("t3a.2xlarge"))
pp(aws._servers.get("c5d.large"))
```
8 changes: 7 additions & 1 deletion sc_crawler/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,15 @@ def get_zones(self):

def get_instance_types(self):
if not hasattr(self, "_servers"):
self._servers = self._methods.get_instance_types()
self._servers = self._methods.get_instance_types(self)
return self._servers

def get_all(self):
self.get_datacenters()
self.get_zones()
self.get_instance_types()
return


class Datacenter(BaseModel):
identifier: str
Expand Down

0 comments on commit 990a143

Please sign in to comment.