Skip to content

Commit b3191f5

Browse files
authored
Merge branch 'master' into master
2 parents 038602b + e660ed7 commit b3191f5

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ stages:
44
if: tag IS present
55
language: python
66
python:
7-
- "2.6"
87
- "2.7"
98
- "3.4"
109
- "3.5"

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,33 @@ service.terminate()
125125
```
126126

127127

128+
# Send attachement (screenshots)
129+
130+
[python-client](https://github.com/reportportal/client-Python/blob/64550693ec9c198b439f8f6e8b23413812d9adf1/reportportal_client/service.py#L259) uses `request` library for working with RP and the same semantics to work with attachments (data).
131+
132+
There are two ways to pass data as attachment:
133+
134+
### Case 1 - pass file-like object
135+
```
136+
with open(screenshot_file_path, "rb") as image_file:
137+
rp_logger.info("Some Text Here",
138+
attachment={"name": "test_name_screenshot.png",
139+
"data": image_file,
140+
"mime": "image/png"})
141+
```
142+
143+
### Case 2 - pass file content itself (like you did)
144+
```
145+
with open(screenshot_file_path, "rb") as image_file:
146+
file_data = image_file.read()
147+
148+
rp_logger.info("Some Text Here",
149+
attachment={"name": "test_name_screenshot.png",
150+
"data": file_data,
151+
"mime": "image/png"})
152+
```
153+
154+
128155
# Copyright Notice
129156

130157
Licensed under the [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)

0 commit comments

Comments
 (0)