Skip to content

Commit 3f4e8cc

Browse files
authored
Merge pull request #4 from fireeye/feature/presigned-url
Fixed comments in fireeyepy that incorrectly described the behavior o…
2 parents 12bd89f + d71bda5 commit 3f4e8cc

File tree

3 files changed

+41
-7
lines changed

3 files changed

+41
-7
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# FireEye Client Library for Python
55
This is the Python client library for all things FireEye API. Currently it only supports FireEye's Detection On Demand but will have support for other FireEye API's soon.
66

7+
For more API information, visit the [FireEye Developer Hub](https://fireeye.dev)
8+
79
Installation
810
------------
911

@@ -34,6 +36,8 @@ Construct a Detection object with your api key:
3436
```python
3537
detection = fireeyepy.Detection(key=api_key)
3638
```
39+
To obtain a free trial API key, subscribe on the [AWS Marketplace](https://aws.amazon.com/marketplace/pp/B07XSMKK41)
40+
3741
### Upload A File
3842
```python
3943
response = detection.submit_file(
@@ -52,6 +56,11 @@ You may also provide the optional `extended=True` flag to get the full, in-depth
5256
response = detection.get_report(report_id, extended=True)
5357
```
5458

59+
### Retrieve Presigned URL for Dashboard Report
60+
```python
61+
result = detection.get_presigned_url(report_id)
62+
```
63+
5564
### Perform Hash Lookup
5665
```python
5766
response = detection.get_hash(hash)

fireeyepy/__init__.py

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import requests
66
import logging
77

8-
__version__ = "0.0.1"
8+
__version__ = "0.1.0"
99
logger = logging.getLogger("fireeye")
1010

1111
class Detection:
@@ -28,7 +28,7 @@ class Detection:
2828
2929
result = detection.submit_file(
3030
files={
31-
"file": ("filenamehere.txt", open("path/to/filenamehere.txt", "r"))
31+
"file": ("filenamehere.txt", open("path/to/filenamehere.txt", "rb"))
3232
}
3333
)
3434
```
@@ -40,7 +40,17 @@ class Detection:
4040
4141
detection = fireeyepy.Detection(key="yourapikeyhere")
4242
43-
result = detection.get_file_result("yoursubmissionkey")
43+
result = detection.get_report("report_id")
44+
```
45+
------------------------------
46+
47+
Example of getting a presigned URL for a browser viewable report
48+
```python
49+
import fireeyepy
50+
51+
detection = fireeyepy.Detection(key="yourapikeyhere")
52+
53+
result = detection.get_presigned_url("report_id")
4454
```
4555
------------------------------
4656
@@ -75,13 +85,21 @@ def submit_file(self, body=None, files=None):
7585
return self.post(self.api_host, "/files", body, files)
7686

7787
def get_report(self, report_id, extended=False):
78-
"""Allows you to get a list of all of your submissions.
88+
"""Allows you to get the report details for a file or hash submission.
7989
8090
Returns:
81-
dict -- Returns a dict of all of the submissions under your API key.
91+
dict -- Returns the report details
8292
"""
8393
return self.get(self.api_host, "/reports/{}".format(report_id), {"extended": extended})
8494

95+
def get_presigned_url(self, report_id, expiry=72):
96+
"""Allows you to get a presigned URL for a browser viewable version of the analysis report
97+
98+
Returns:
99+
dict -- Returns the presigned URL details
100+
"""
101+
return self.get(self.api_host, "/presigned-url/{}".format(report_id), {"expiry": expiry})
102+
85103
def get_hash(self, hash):
86104
"""Allows you to get the malware analysis results for a given hash.
87105

setup.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
# Copyright (C) 2019 FireEye, Inc. All Rights Reserved.
22
from setuptools import setup
33

4+
with open("README.md", "r") as fh:
5+
long_description = fh.read()
6+
47
setup(
58
name="fireeyepy",
6-
version="0.0.1",
9+
version="0.1.0",
710
description="FireEye Client Library for Python",
11+
long_description=long_description,
12+
long_description_content_type="text/markdown",
813
url="https://github.com/fireeye/fireeye-python",
914
author="FireEye",
15+
author_email="[email protected]",
1016
license="MIT",
1117
packages=["fireeyepy"],
1218
platforms=["any"],
13-
install_requires=["requests>=2.4.2"]
19+
install_requires=["requests>=2.4.2"],
20+
python_requires='>=3.6',
1421
)

0 commit comments

Comments
 (0)