Skip to main content

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).

  1. Download this project and use it (copy it in your project, etc).

  2. 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 V1 version of the APIs as follows:
"""
USAGE: <Platform INSTANCE>.<VERSION: eg. v1>.<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.v1.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 package using pip as follows:
pip install pytest
  1. 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
  1. Apply secrets and Run integration tests as follows:
source test_credentials.sh  && python -m pytest test/integration
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fyle-1.3.0.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fyle-1.3.0-py3-none-any.whl (49.5 kB view details)

Uploaded Python 3

File details

Details for the file fyle-1.3.0.tar.gz.

File metadata

  • Download URL: fyle-1.3.0.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for fyle-1.3.0.tar.gz
Algorithm Hash digest
SHA256 4b8c4842c0fccdddc003e95b1d874dbd769383fb475801a427500087bc4a07c9
MD5 f93c51840374d03ff363aeda1c1c7fc8
BLAKE2b-256 7f7243f7cee79c9e19f195b5196299c343cae0b386227b961e73664efe2cc2ec

See more details on using hashes here.

File details

Details for the file fyle-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: fyle-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 49.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for fyle-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04c92fdd6aa91f93a75668d7fe3ac7938ca313b9c14dc02e7295d5acb656cfd9
MD5 7aa11c23d768e69ae6a5df554fc5dbe8
BLAKE2b-256 cec31a8ffdb43654cc14087e73f4f5bff1a5f55ff8b66bb2230de4ad35c2ba03

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page