Skip to content

Commit 6d91cef

Browse files
Merge pull request #19 from Riminder/fix/empty-cv-wrong-file-obj
Fix: Use File object instead of bytes & Handle BytesIO objet with no file name
2 parents a2d60a7 + b601927 commit 6d91cef

11 files changed

Lines changed: 276 additions & 232 deletions

Documentation.md

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -94,36 +94,33 @@ JSON object with 5 required fields: `key`, `reference`, `info`, `text_language`
9494
### 🧠 **Parse a Resume in a Source**
9595
This endpoint allows you to parse a resume and make a profile object from it.
9696
> 📘 **Real-time parsing**: To use the real-time parsing feature, you must have it enabled for the correponding source. In which case you just need to set `sync_parsing` to `1`.
97-
- Open the file in `binary mode`
97+
- Open the file in `binary mode` and parse it using this method without reference
9898
```python
99-
>>> with open("path/2/file", "rb") as f:
100-
profile_file = f.read()
101-
102-
```
103-
- Parse it using this method without reference:
104-
```python
105-
>>> response = client.profile.parsing.add_file(
106-
source_key="source_key",
107-
profile_file=profile_file,
108-
sync_parsing=1,
109-
sync_parsing_indexing=1,
110-
webhook_parsing_sending=0,
111-
tags=[{"name": "archive", "value": True}],
112-
)
99+
>>> with open("path/2/file", "rb") as profile_file:
100+
... response = client.profile.parsing.add_file(
101+
source_key="source_key",
102+
profile_file=profile_file,
103+
sync_parsing=1,
104+
sync_parsing_indexing=1,
105+
webhook_parsing_sending=0,
106+
tags=[{"name": "archive", "value": True}],
107+
)
113108
```
114109
115110
- Or using a reference like this:
116111
```python
117-
>>> response = client.profile.parsing.add_file(
118-
source_key="source_key",
119-
reference="my_resume",
120-
profile_file=profile_file,
121-
sync_parsing=1,
122-
sync_parsing_indexing=1,
123-
webhook_parsing_sending=0,
124-
tags=[{"name": "archive", "value": True}],
125-
)
112+
>>> with open("path/2/file", "rb") as profile_file:
113+
... response = client.profile.parsing.add_file(
114+
source_key="source_key",
115+
reference="my_resume",
116+
profile_file=profile_file,
117+
sync_parsing=1,
118+
sync_parsing_indexing=1,
119+
webhook_parsing_sending=0,
120+
tags=[{"name": "archive", "value": True}],
121+
)
126122
```
123+
127124
In both cases the output should look like this:
128125
```
129126
{

README.md

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,14 @@ from hrflow import Hrflow
5959
client = Hrflow(api_secret="YOUR_API_KEY", api_user="YOU_USER_EMAIL")
6060

6161
# read file from directory (in binary mode)
62-
with open("path_to_file.pdf", "rb") as f:
63-
file = f.read()
64-
65-
66-
#Parse it using this method without reference:
67-
response = client.profile.parsing.add_file(
68-
source_key="INSERT_THE_TARGET_SOURCE_KEY",
69-
profile_file=file,
70-
sync_parsing=1, # This is to invoke real time parsing
71-
tags=[{"name": "application_reference", "value": "TS_X12345"}], # Attach an application tag to the profile to be parsed
72-
)
62+
with open("path_to_file.pdf", "rb") as profile_file:
63+
# Parse it using this method without reference:
64+
response = client.profile.parsing.add_file(
65+
source_key="INSERT_THE_TARGET_SOURCE_KEY",
66+
profile_file=file,
67+
sync_parsing=1, # This is to invoke real time parsing
68+
tags=[{"name": "application_reference", "value": "TS_X12345"}], # Attach an application tag to the profile to be parsed
69+
)
7370
```
7471

7572

0 commit comments

Comments
 (0)