There is no parent module to import from #512
-
Describe the bug from ._util import force_default, process_service_request To Reproduce Expected behavior Environment (please complete the following information):
Additional context |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
Are you trying to execute the code in src/falconpy/discover.py directly? (This won't work, you'll need to import the main package.) Working example
from falconpy import Discover
discover = Discover(client_id="API_KEY_HERE", client_secret="API_SECRET_HERE")
print(discover.query_hosts(limit=1)) |
Beta Was this translation helpful? Give feedback.
-
No
1. I am trying to execute my code in my home directory where I have copied discover.py file only and the rest of the modules should be in the path, like any other module(s)
2. I have already installed 0.9.0 version
3. In the discover.py, I have inserted the right creds
Thanks!
|
Beta Was this translation helpful? Give feedback.
-
The discover.py module is not intended to be executed stand-alone. You shouldn't have to copy any falconpy source into your folder, just installing the package should make it available for import using If you'd like, go ahead and paste a sample of your code here and I can see if I can't give you an example for what you're trying to do.
|
Beta Was this translation helpful? Give feedback.
-
Follow up: here's a basic example for retrieving hosts identified by Discover. from falconpy import Discover
discover = Discover(client_id="API_ID_HERE", client_secret="API_SECRET_HERE")
# Limit can be adjusted up to the maximum of 100
hosts_found = discover.query_hosts(limit=20)
# Maximum number of ids that can be retrieved is also 100
host_details = discover.get_hosts(ids=hosts_found["body"]["resources"])
for host in host_details["body"]["resources"]:
display = "Hostname / IP not found"
if "local_ip" in host:
display = host["local_ip"]
if "hostname" in host:
display = host["hostname"]
print(display) |
Beta Was this translation helpful? Give feedback.
-
Thanks – would be a good idea if we could add a sample code to ‘consume’ these functions/APIs.
What I am trying to do is just ensure that Falcon is accessible to our SOC team, effectively validating that Crowdstrike back-end to our network connectivity are all working/operational and I chose discover API as my ‘solution’ for the above use-case.
Now, I will create a sample code and send it across later today.
Bests,
|
Beta Was this translation helpful? Give feedback.
-
For your SOC team - additional documentation can be found in our wiki (link in the tabs above), or on https://falconpy.io. We don't have any Discover samples online yet, but they may also find value in the other samples we've posted in the repo here: https://github.com/CrowdStrike/falconpy/tree/main/samples. Thanks for the question! 😄 |
Beta Was this translation helpful? Give feedback.
Follow up: here's a basic example for retrieving hosts identified by Discover.