Client library for the Affinda API
Project description
Affinda API - Python Client Library
Generated using autorest and autorest.python.
Installation
pip install affinda
Or latest dev from github
git clone git@github.com:affinda/affinda-python.git
cd affinda-python
pip install -e .
Quickstart
from pathlib import Path
from affinda import AffindaAPI, TokenCredential
TOKEN = "YOUR_API_TOKEN"
file_pth = Path("path_to_file")
credential = TokenCredential(token=TOKEN)
client = AffindaAPI(credential=credential)
with open(file_pth, "rb") as f:
resp = client.create_resume(file=f, file_name="test.pdf", wait=False)
API reference
Parser
Gets summary information for all resumes of a user
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
all_resumes = client.get_all_resumes()
print(all_resumes.as_dict())
Uploads a resume for parsing
from pathlib import Path
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
identifier = "REPLACE_IDENTIFIER"
file_pth = Path("path_to_file")
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
with open(file_pth, "rb") as f:
resume = client.create_resume(file=f, file_name=file_pth.name, wait=True)
print(resume.as_dict())
Gets parse results for a specific resume
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
identifier = "REPLACE_IDENTIFIER"
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
resume = client.get_resume(identifier=identifier)
print(resume.as_dict())
Deletes a resume
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
identifier = "REPLACE_IDENTIFIER"
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
response = client.delete_resume(identifier=identifier)
print(response.as_dict())
Redactor
Gets summary information for all redacted resumes of a user
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
all_redacted_resumes = client.get_all_redacted_resumes()
print(all_redacted_resumes.as_dict())
Uploads a resume for redacting
from pathlib import Path
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
identifier = "REPLACE_IDENTIFIER"
file_pth = Path("path_to_file")
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
with open(file_pth, "rb") as f:
redacted_resume = client.create_redacted_resume(file=f, file_name=file_pth.name)
print(redacted_resume.as_dict())
Gets redaction results for a specific resume
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
identifier = "REPLACE_IDENTIFIER"
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
redacted_resume = client.get_redacted_resume(identifier=identifier)
print(redacted_resume.as_dict())
Deletes a redacted resume
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
identifier = "REPLACE_IDENTIFIER"
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
response = client.delete_redacted_resume(identifier=identifier)
print(response.as_dict())
Reformatter
Gets summary information for all resume formats of a user
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
resume_formats = client.get_all_resume_formats()
print(resume_formats.as_dict())
Gets summary information for all reformatted resumes of a user
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
all_reformatted_resumes = client.get_all_reformatted_resumes()
print(all_reformatted_resumes.as_dict())
Uploads a resume for reformatting
from pathlib import PathAdding basic test suite
from affinda import TokenCredential, AffindaAPI
token = "REPLACE_TOKEN"
resume_format = "REPLACE_FORMAT_IDENTIFIER"
file_pth = Path("path_to_file")
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
with open(file_pth, "rb") as f:
reformatted_resume = client.create_reformatted_resume(file=f,
file_name=file_pth.name,
resume_format=resume_format)
print(reformatted_resume.as_dict())
Gets reformatting results for a specific resume
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
identifier = "REPLACE_IDENTIFIER"
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
reformatted_resume = client.get_reformatted_resume(identifier=identifier)
print(reformatted_resume.as_dict())
Deletes a reformatted resume
from affinda import AffindaAPI, TokenCredential
token = "REPLACE_TOKEN"
identifier = "REPLACE_IDENTIFIER"
credential = TokenCredential(token=token)
client = AffindaAPI(credential=credential)
response = client.delete_reformatted_resume(identifier=identifier)
print(response.as_dict())
0.1.5 - 2021-08-25
Added
- Added flake, editorconfig, tox.ini etc files to match best practices for existing Draftable/Affinda projects (thanks @ralish!)
0.1.4 - 2021-08-18
Fixes:
- Update README.md to fix install instructions
0.1.3 - 2021-08-18
Fixes:
- Update README.md to hard link to github hosted logo to fix display on PyPi
0.1.2 - 2021-08-18
- Initial release
Follows the format from https://keepachangelog.com/en/1.0.0/
The MIT License (MIT)
Copyright (c) Affinda
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file affinda-0.1.5.tar.gz
.
File metadata
- Download URL: affinda-0.1.5.tar.gz
- Upload date:
- Size: 63.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55052c577a513dce360896d0e24e654b12a872976df20e58e23927cbe3fd8ed1 |
|
MD5 | 81320e6742971e966883ae4b21d258f6 |
|
BLAKE2b-256 | dd43958460b96afb49cc69fc0903e27e4b7d1a0a89f53ab1c0cadeab1e58cfab |
File details
Details for the file affinda-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: affinda-0.1.5-py3-none-any.whl
- Upload date:
- Size: 31.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/3.10.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.8.11
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ffbb2a486abbd6a7fd92fac35735e9b8f346c0a301dad1d11581f40c88043cdd |
|
MD5 | e56ddba91999bd24db2b56294dc51b82 |
|
BLAKE2b-256 | 588d13e7ebca1ead3ca015bb7044c3b95d3be1bf4c0ef3c0c8838f0a54ac1e45 |