-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding Support for Approver Expenses (#40)
* Adding Support for Approver Expenses * Updating the version in setup.py * Updating the Readme with steps * Fixing import path in Readme
- Loading branch information
Showing
4 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,61 @@ | ||
# fyle-platform-sdk-py | ||
Python SDK for accessing Fyle Platform APIs | ||
# 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 [email protected]. | ||
|
||
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']) | ||
|
||
``` | ||
## 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
V1 Beta Approver Expenses | ||
""" | ||
|
||
from ....internals.get_resources import GetResources | ||
from ....internals.list_all_resources import ListAllResources | ||
from ....internals.list_resources import ListResources | ||
from ....internals.post_resources import PostResources | ||
|
||
|
||
class Expenses(ListResources, ListAllResources, PostResources, GetResources): | ||
"""Class for Expenses APIs.""" | ||
|
||
EXPENSES = '/expenses' | ||
|
||
def __init__(self, version, role): | ||
super().__init__(version, role, Expenses.EXPENSES) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
|
||
setuptools.setup( | ||
name='fyle', | ||
version='v0.21.0', | ||
version='v0.22.0', | ||
author='Siva Narayanan', | ||
author_email='[email protected]', | ||
description='Python SDK for accessing Fyle Platform APIs', | ||
|