updated docs, ironed out a few things

This commit is contained in:
2022-04-20 01:16:57 +02:00
parent 77acc768e2
commit 6b393f95fa
2 changed files with 17 additions and 17 deletions

View File

@@ -4,12 +4,24 @@ This is a wrapper of [the roly-poly, not 100% ergonomic Freshbooks web API](http
There are "band-aids" here to work around some of the API's shortcomings.
# Install
# Installation
```
pip install avt-fresh
```
See `Initializing` for additional setup.
# Usage
Instantiate the avt_fresh `Client` like so, and you're off to the races:
```python
client = Client(client_secret="...", client_id="...", redirect_uri="https://...", account_id="...")
monster_invoices = client.get_all_invoices_for_org_name("Monsters Inc")
```
You can get and set the required arguments to `Client` [here](https://my.freshbooks.com/#/developer). Well, all of them except `FRESHBOOKS_ACCOUNT_ID`, which you can see (there's got to be another way??) by clicking on one of your invoices and grabbing the substring here: `https://my.freshbooks.com/#/invoice/<THIS THING>-1234567`.
Don't tell anyone but `redirect_uri` can be pretty much anything! See `Initializing` below 👇.
# The Goodies
@@ -104,20 +116,6 @@ class FreshbooksContact(NamedTuple):
Then, `client.update_contacts`, `client.delete_contact`, `client.add_contacts`, `client.get_freshbooks_client_from_client_id`, `client.get_freshbooks_client_from_email`, and `client.get_freshbooks_client_from_org_name`.
# Prerequisites/Configuration
Instantiate the avt_fresh `Client` like so:
```python
client = Client(client_secret="...", client_id="...", redirect_uri="https://...", account_id="...")
```
You can get and set these goodies [here](https://my.freshbooks.com/#/developer). Well, all of them except `FRESHBOOKS_ACCOUNT_ID`, which you can see (there's got to be another way??) by clicking on one of your invoices and grabbing the substring here: `https://my.freshbooks.com/#/invoice/<THIS THING>-1234567`.
Don't tell anyone but `redirect_uri` can be pretty much anything! See `Initializing` below 👇.
## Security
Which brings me to an important point. Currently it's going to save your OAuth tokens in the ever-so-insecure path of `~/freshbooks_oauth_token.json`. TODO: don't do this anymore. ¯\_(ツ)_/¯
# Initializing
When you first call one of the functions which touches the Freshbooks API, you'll be prompted in the terminal like so:
@@ -139,6 +137,8 @@ You should only have to do this once in each environment you use this library in
# Hardcoded Stuff / TODOs
Here are some quirks and TODOs. PRs are welcome!:
OAuth tokens are currently saved in the ever-so-insecure path of `~/freshbooks_oauth_token.json`. TODO: don't do this anymore. ¯\_(ツ)_/¯
Only Python 3.10 is supported at the moment.
When it comes to invoice statuses, we're only using `v3_status` strings, not the numbers. What's more, when you create an invoice we're only supporting two possible statuses: "draft" and "paid".

View File

@@ -4,7 +4,7 @@ setup(
name="avt_fresh",
author="Zev Averbach",
author_email="zev@averba.ch",
version="0.0.12",
version="0.0.13",
license="MIT",
python_requires=">3.10.0",
keywords="freshbooks API",