# Fyle
Python SDK for accessing Fyle Platform APIs. [Fyle](https://www.fylehq.com/) is an expense management system.
## Installation
This project requires [Python 3+](https://www.python.org/downloads/) and [Requests](https://pypi.org/project/requests/) library (pip install requests).
1. Download this project and use it (copy it in your project, etc).
2. Install it from [pip](https://pypi.org).
$ pip install fyle
## Usage
To use this SDK you'll need these Fyle credentials used for OAuth2 authentication: **client ID**, **client secret** and **refresh token**. You can follow the steps on this [Article](https://help.fylehq.com/en/articles/3045578-integrating-with-fyle) or reach out to support@fylehq.com.
This SDK is very easy to use.
* First you'll need to create a connection using the main class Platform.
```python
from fyle.platform import Platform
fyle = Platform(
server_url='FYLE SERVER URL',
token_url='FYLE TOKEN URL',
refresh_token='FYLE REFRESH TOKEN',
client_id='FYLE CLIENT ID',
client_secret='FYLE CLIENT SECRET'
)
```
* You can access the V1beta version of the APIs as follows:
```python
"""
USAGE: <Platform INSTANCE>.<VERSION: eg. v1beta>.<FYLE ROLE: eg. admin>.<API_NAME: eg. expenses>.<API_METHOD: eg. get>(<PARAMETERS>)
"""
# Get a list of all Expenses in a paginated manner and add to a list
expenses = []
query_params = {
'order': 'created_at.desc'
}
expenses_generator = fyle.v1beta.admin.expenses.list_all(query_params=query_params)
for response in expenses_generator:
if response.get('data'):
expenses.extend(response['data'])
```
## Integration Tests
1. Install [pytest](https://pypi.org/project/pytest/) package using pip as follows:
```
pip install pytest
```
2. Add the following environment variables to test_credentials.sh file
```
export SERVER_URL=<FYLE SERVER URL>
export TOKEN_URL=<FYLE TOKEN URL>
export REFRESH_TOKEN=<FYLE REFRESH TOKEN>
export CLIENT_ID=<FYLE CLIENT ID>
export CLIENT_SECRET=<FYLE CLIENT SECRET>
```
##### NOTE: The credentials used should have required roles assigned to them
3. Apply secrets and Run integration tests as follows:
```
source test_credentials.sh && python -m pytest test/integration
```
4. To get the code coverage execute the following:
```
pytest test/ --cov
```
Currently the code coverage is at 95%
## Release latest version to [PyPi](https://pypi.org/project/fyle/)
* Open the releases section on GitHub and [Draft a new release](https://github.com/fylein/fyle-platform-sdk-py/releases/new).
* Check the version in setup.py, make sure you update that version along with your changes.
* Add the version and description and click ok `Publish Release` button.
* This will trigger the github action and automatically push the SDK to PyPi
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
Raw data
{
"_id": null,
"home_page": "https://github.com/fylein/fyle-platform-sdk-py",
"name": "fyle",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "fyle, api, python, sdk",
"author": "Siva Narayanan",
"author_email": "siva@fyle.in",
"download_url": "https://files.pythonhosted.org/packages/8e/48/54007c7e291d9159b4697ca6602ed7860425c667e333fd988e03bfc7f204/fyle-0.37.2.tar.gz",
"platform": null,
"description": "# Fyle\n\nPython SDK for accessing Fyle Platform APIs. [Fyle](https://www.fylehq.com/) is an expense management system.\n\n## Installation\n\nThis project requires [Python 3+](https://www.python.org/downloads/) and [Requests](https://pypi.org/project/requests/) library (pip install requests).\n\n1. Download this project and use it (copy it in your project, etc).\n2. Install it from [pip](https://pypi.org).\n \n $ pip install fyle\n\n## Usage\n\nTo use this SDK you'll need these Fyle credentials used for OAuth2 authentication: **client ID**, **client secret** and **refresh token**. You can follow the steps on this [Article](https://help.fylehq.com/en/articles/3045578-integrating-with-fyle) or reach out to support@fylehq.com.\n\nThis SDK is very easy to use.\n* First you'll need to create a connection using the main class Platform.\n```python\nfrom fyle.platform import Platform\n\nfyle = Platform(\n server_url='FYLE SERVER URL',\n token_url='FYLE TOKEN URL',\n refresh_token='FYLE REFRESH TOKEN',\n client_id='FYLE CLIENT ID',\n client_secret='FYLE CLIENT SECRET'\n)\n```\n\n* You can access the V1beta version of the APIs as follows:\n```python\n\"\"\"\nUSAGE: <Platform INSTANCE>.<VERSION: eg. v1beta>.<FYLE ROLE: eg. admin>.<API_NAME: eg. expenses>.<API_METHOD: eg. get>(<PARAMETERS>)\n\"\"\"\n\n# Get a list of all Expenses in a paginated manner and add to a list\nexpenses = []\n\nquery_params = {\n 'order': 'created_at.desc'\n}\n\nexpenses_generator = fyle.v1beta.admin.expenses.list_all(query_params=query_params)\n\nfor response in expenses_generator:\n if response.get('data'):\n expenses.extend(response['data'])\n\n```\n\n## Integration Tests\n\n1. Install [pytest](https://pypi.org/project/pytest/) package using pip as follows:\n\n```\npip install pytest\n```\n\n2. Add the following environment variables to test_credentials.sh file\n\n```\n export SERVER_URL=<FYLE SERVER URL>\n export TOKEN_URL=<FYLE TOKEN URL>\n export REFRESH_TOKEN=<FYLE REFRESH TOKEN>\n export CLIENT_ID=<FYLE CLIENT ID>\n export CLIENT_SECRET=<FYLE CLIENT SECRET>\n```\n##### NOTE: The credentials used should have required roles assigned to them\n\n3. Apply secrets and Run integration tests as follows:\n\n```\nsource test_credentials.sh && python -m pytest test/integration\n```\n4. To get the code coverage execute the following:\n\n```\npytest test/ --cov\n```\nCurrently the code coverage is at 95%\n\n## Release latest version to [PyPi](https://pypi.org/project/fyle/)\n\n* Open the releases section on GitHub and [Draft a new release](https://github.com/fylein/fyle-platform-sdk-py/releases/new).\n* Check the version in setup.py, make sure you update that version along with your changes.\n* Add the version and description and click ok `Publish Release` button.\n* This will trigger the github action and automatically push the SDK to PyPi\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Python SDK for accessing Fyle Platform APIs",
"version": "0.37.2",
"project_urls": {
"Homepage": "https://github.com/fylein/fyle-platform-sdk-py"
},
"split_keywords": [
"fyle",
" api",
" python",
" sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "95bab424e46716e4b77d2ad1aba1b7a30131fa8fef4f12d0f72e5bbc009131be",
"md5": "e7ad0f15baa8c93142214ebf90ff8c8d",
"sha256": "43ad1e473441f33445f01a04f00764d0394ca3c474f67d1701eb7d48452fc0ff"
},
"downloads": -1,
"filename": "fyle-0.37.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e7ad0f15baa8c93142214ebf90ff8c8d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 49465,
"upload_time": "2024-10-13T15:18:57",
"upload_time_iso_8601": "2024-10-13T15:18:57.686043Z",
"url": "https://files.pythonhosted.org/packages/95/ba/b424e46716e4b77d2ad1aba1b7a30131fa8fef4f12d0f72e5bbc009131be/fyle-0.37.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8e4854007c7e291d9159b4697ca6602ed7860425c667e333fd988e03bfc7f204",
"md5": "c85595bb04b9b7194ef1c3e03847796e",
"sha256": "f906f228da816ec8926c160c7d5eb9b52d52b7072af4b4350fd8c71e29fb6b07"
},
"downloads": -1,
"filename": "fyle-0.37.2.tar.gz",
"has_sig": false,
"md5_digest": "c85595bb04b9b7194ef1c3e03847796e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 23997,
"upload_time": "2024-10-13T15:18:59",
"upload_time_iso_8601": "2024-10-13T15:18:59.185696Z",
"url": "https://files.pythonhosted.org/packages/8e/48/54007c7e291d9159b4697ca6602ed7860425c667e333fd988e03bfc7f204/fyle-0.37.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-13 15:18:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "fylein",
"github_project": "fyle-platform-sdk-py",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "astroid",
"specs": [
[
"==",
"2.4.2"
]
]
},
{
"name": "attrs",
"specs": [
[
"==",
"20.3.0"
]
]
},
{
"name": "certifi",
"specs": [
[
"==",
"2022.12.7"
]
]
},
{
"name": "chardet",
"specs": [
[
"==",
"3.0.4"
]
]
},
{
"name": "enum34",
"specs": [
[
"==",
"1.1.10"
]
]
},
{
"name": "idna",
"specs": [
[
"==",
"2.10"
]
]
},
{
"name": "iniconfig",
"specs": [
[
"==",
"1.1.1"
]
]
},
{
"name": "isort",
"specs": [
[
"==",
"5.6.4"
]
]
},
{
"name": "jsonschema",
"specs": [
[
"==",
"3.2.0"
]
]
},
{
"name": "lazy-object-proxy",
"specs": [
[
"==",
"1.4.3"
]
]
},
{
"name": "mccabe",
"specs": [
[
"==",
"0.6.1"
]
]
},
{
"name": "packaging",
"specs": [
[
"==",
"20.7"
]
]
},
{
"name": "pluggy",
"specs": [
[
"==",
"0.13.1"
]
]
},
{
"name": "py",
"specs": [
[
"==",
"1.10.0"
]
]
},
{
"name": "pylint",
"specs": [
[
"==",
"2.6.0"
]
]
},
{
"name": "pyparsing",
"specs": [
[
"==",
"2.4.7"
]
]
},
{
"name": "pyrsistent",
"specs": [
[
"==",
"0.17.3"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"6.1.2"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.31.0"
]
]
},
{
"name": "six",
"specs": [
[
"==",
"1.15.0"
]
]
},
{
"name": "toml",
"specs": [
[
"==",
"0.10.2"
]
]
},
{
"name": "urllib3",
"specs": [
[
"==",
"1.26.18"
]
]
},
{
"name": "wrapt",
"specs": [
[
"==",
"1.12.1"
]
]
}
],
"lcname": "fyle"
}