Python SDK for accessing Fyle Platform APIs
Project description
Fyle
Python SDK for accessing Fyle Platform APIs. Fyle is an expense management system.
Installation
This project requires Python 3+ and Requests library (pip install requests).
-
Download this project and use it (copy it in your project, etc).
-
Install it from pip.
$ 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 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.
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:
"""
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
- Install pytest package using pip as follows:
pip install pytest
- 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
- Apply secrets and Run integration tests as follows:
source test_credentials.sh && python -m pytest test/integration
- To get the code coverage execute the following:
pytest test/ --cov
Currently the code coverage is at 95%
Release latest version to PyPi
- Open the releases section on GitHub and Draft a new release.
- 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 file for details
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 fyle-0.37.2.tar.gz
.
File metadata
- Download URL: fyle-0.37.2.tar.gz
- Upload date:
- Size: 24.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f906f228da816ec8926c160c7d5eb9b52d52b7072af4b4350fd8c71e29fb6b07 |
|
MD5 | c85595bb04b9b7194ef1c3e03847796e |
|
BLAKE2b-256 | 8e4854007c7e291d9159b4697ca6602ed7860425c667e333fd988e03bfc7f204 |
File details
Details for the file fyle-0.37.2-py3-none-any.whl
.
File metadata
- Download URL: fyle-0.37.2-py3-none-any.whl
- Upload date:
- Size: 49.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43ad1e473441f33445f01a04f00764d0394ca3c474f67d1701eb7d48452fc0ff |
|
MD5 | e7ad0f15baa8c93142214ebf90ff8c8d |
|
BLAKE2b-256 | 95bab424e46716e4b77d2ad1aba1b7a30131fa8fef4f12d0f72e5bbc009131be |