Skip to main content

Public class

Project description

freeagent

freeagent is a python library for using the freeagent API.

Initial setup

Create an API app entry at the Freeagent Dev Portal

Exmple

from os import environ
import json

from freeagent import FreeAgent

def _load_token():
    with open("token.json", "r") as f:
        token = json.load(f)
    except (FileNotFoundError, json.JSONDecodeError):
        token = None
    return token

def _save_token(token_data):
    # save the token
    with open("token.json", "w") as f:
        json.dump(token_data, f)

client_id = environ["FREEAGENT_ID"]
client_secret = environ["FREEAGENT_SECRET"]

token = _load_token()

freeagent_client = FreeAgent()
freeagent_client.authenticate(client_id, client_secret ,_save_token, token)

main_response = freeagent_client.get_api("users/me")
print(
f"✅ Authenticated! User info: {main_response['user']['first_name']} {main_response['user']['last_name']}"
)

paypal_id = freeagent_client.bank.get_first_paypal_id()
paypal_data = freeagent_client.bank.get_unexplained_transactions(paypal_id)

Documentation

Full documentation is available at
👉 https://a16bitsysop.github.io/freeagentPY/


Running Tests

Run tests:

pytest

Contributing

Contributions are welcome! Please:

  1. Fork the repo
  2. Create your feature branch git checkout -b my-feature
  3. Edit the source code to add and test your changes
  4. Commit your changes git commit -m 'Add some feature'
  5. Push to your branch git push origin my-feature
  6. Open a Pull Request

Please follow the existing code style and write tests for new features.


License

This project is licensed under the MIT MIT License.


Contact

Created and maintained by Duncan Bellamy. Feel free to open issues or reach out on GitHub.


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

freeagent-0.2.1.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

freeagent-0.2.1-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file freeagent-0.2.1.tar.gz.

File metadata

  • Download URL: freeagent-0.2.1.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for freeagent-0.2.1.tar.gz
Algorithm Hash digest
SHA256 108df8b7b4e577c75fb67ab6a49ef9452ae899f586af1a7478c587eb3cff1489
MD5 676b255f0f3b10780171d2b603140415
BLAKE2b-256 cd5373b539464ca73691563cf23bf1637d942eae9011b8f2a3e99fa9545f0203

See more details on using hashes here.

Provenance

The following attestation bundles were made for freeagent-0.2.1.tar.gz:

Publisher: publish.yaml on a16bitsysop/freeagentPY

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file freeagent-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: freeagent-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for freeagent-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 78b8563d52f9c4d317b468839a82dd360662d728d9b8e67d81b490e01fc93e53
MD5 dd709673ca16260bb8fd19070b062c64
BLAKE2b-256 d293a60b277c6793c6fd89b43b1400d3861ba19a8eb8f0bb6a8a31ad2d2c3b89

See more details on using hashes here.

Provenance

The following attestation bundles were made for freeagent-0.2.1-py3-none-any.whl:

Publisher: publish.yaml on a16bitsysop/freeagentPY

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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