# 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://www.fylehq.com/help/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/56/4e0786260ef3a8b567b0f8f259760a674e6549ad55b164cacd0572449326/fyle-0.37.3.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://www.fylehq.com/help/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.3",
"project_urls": {
"Homepage": "https://github.com/fylein/fyle-platform-sdk-py"
},
"split_keywords": [
"fyle",
" api",
" python",
" sdk"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "4e0274bb4675a47192d6012cf03e4bf4ab2d2fbbb5085fc1dc3414118db502b3",
"md5": "3a544abc1f8d0f44aa44c56334ad4695",
"sha256": "8f555708e33167b7bd77d671b6906a19f49c95d84e46c99302f5dccc2237532d"
},
"downloads": -1,
"filename": "fyle-0.37.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3a544abc1f8d0f44aa44c56334ad4695",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 49519,
"upload_time": "2025-04-09T11:06:41",
"upload_time_iso_8601": "2025-04-09T11:06:41.995490Z",
"url": "https://files.pythonhosted.org/packages/4e/02/74bb4675a47192d6012cf03e4bf4ab2d2fbbb5085fc1dc3414118db502b3/fyle-0.37.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8e564e0786260ef3a8b567b0f8f259760a674e6549ad55b164cacd0572449326",
"md5": "d71e7eb434b9831590c35d1435564c53",
"sha256": "33e8fc8a99cee758e59332695bdd8772d94d0df6b11dc8d7955a495f3694871d"
},
"downloads": -1,
"filename": "fyle-0.37.3.tar.gz",
"has_sig": false,
"md5_digest": "d71e7eb434b9831590c35d1435564c53",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 24136,
"upload_time": "2025-04-09T11:06:43",
"upload_time_iso_8601": "2025-04-09T11:06:43.339819Z",
"url": "https://files.pythonhosted.org/packages/8e/56/4e0786260ef3a8b567b0f8f259760a674e6549ad55b164cacd0572449326/fyle-0.37.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-04-09 11:06:43",
"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": "enum34",
"specs": [
[
"==",
"1.1.10"
]
]
},
{
"name": "pytest",
"specs": [
[
"==",
"8.3.4"
]
]
},
{
"name": "pytest-cov",
"specs": [
[
"==",
"6.0.0"
]
]
},
{
"name": "pytest-mock",
"specs": [
[
"==",
"3.14.0"
]
]
},
{
"name": "requests",
"specs": [
[
"==",
"2.32.3"
]
]
},
{
"name": "pylint",
"specs": [
[
"==",
"3.3.4"
]
]
}
],
"lcname": "fyle"
}