finary-uapi 0.1.2__tar.gz → 0.1.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/PKG-INFO +30 -2
  2. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/README.md +30 -1
  3. finary_uapi-0.1.4/finary_uapi/CONTRIBUTING.md +11 -0
  4. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/__init__.py +1 -1
  5. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/__main__.py +12 -2
  6. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/currencies.py +1 -0
  7. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/securities.py +3 -1
  8. finary_uapi-0.1.4/finary_uapi/sharing.py +25 -0
  9. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_me.py +10 -0
  10. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_portfolio.py +6 -0
  11. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/pyproject.toml +3 -3
  12. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/LICENSE +0 -0
  13. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/auth.py +0 -0
  14. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/bank_account_types.py +0 -0
  15. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/constants.py +0 -0
  16. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/crypto_chains.py +0 -0
  17. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/generic_asset_categories.py +0 -0
  18. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/importers/crypto_generic_csv.py +0 -0
  19. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/importers/cryptocom.py +0 -0
  20. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/importers/stocks_generic_csv.py +0 -0
  21. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/institutions.py +0 -0
  22. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/precious_metals.py +0 -0
  23. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/scpis.py +0 -0
  24. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/signin.py +0 -0
  25. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_cryptos.py +0 -0
  26. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_fonds_euro.py +0 -0
  27. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_generic_assets.py +0 -0
  28. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_holdings_accounts.py +0 -0
  29. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_precious_metals.py +0 -0
  30. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_real_estates.py +0 -0
  31. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_scpis.py +0 -0
  32. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_securities.py +0 -0
  33. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/user_startups.py +0 -0
  34. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/utils.py +0 -0
  35. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/views.py +0 -0
  36. {finary_uapi-0.1.2 → finary_uapi-0.1.4}/finary_uapi/watches.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: finary-uapi
3
- Version: 0.1.2
3
+ Version: 0.1.4
4
4
  Summary: Finary API client and command line tool to interact with your Finary account.
5
5
  License: MIT
6
6
  Author: lasconic
@@ -31,7 +31,7 @@ If you don't already have an account, here is a referral link to sign up: https:
31
31
 
32
32
  ## Quick start
33
33
 
34
- 1. Install requirements. `pip install -r requirements.txt`.
34
+ 1. Install requirements. `pip install finary_uapi`.
35
35
  2. Copy paste the `credentials.json.tpl` file to `credentials.json` and file your username and password.
36
36
  3. Run `python -m finary_uapi signin`
37
37
  4. You are good to go and can explore the API. Run `python -m finary_uapi` for available commands.
@@ -137,3 +137,31 @@ python -m finary_uapi dashboard gross all | jq '.result["total"]["amount"]'
137
137
  * Delete responses should be normalized, sometimes we get json back sometimes nothing but the 204 HTTP code.
138
138
 
139
139
 
140
+
141
+ ## Contributors ✨
142
+
143
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
144
+ [![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)
145
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
146
+
147
+ Thanks go to these people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
148
+
149
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
150
+ <!-- prettier-ignore-start -->
151
+ <!-- markdownlint-disable -->
152
+ <table>
153
+ <tbody>
154
+ <tr>
155
+ <td align="center" valign="top" width="16.66%"><a href="http://lasconic.com"><img src="https://avatars.githubusercontent.com/u/234271?v=4?s=100" width="100px;" alt="Nicolas Froment"/><br /><sub><b>Nicolas Froment</b></sub></a><br /><a href="#projectManagement-lasconic" title="Project Management">📆</a> <a href="#promotion-lasconic" title="Promotion">📣</a> <a href="https://github.com/lasconic/finary_uapi/commits?author=lasconic" title="Code">💻</a> <a href="https://github.com/lasconic/finary_uapi/issues?q=author%3Alasconic" title="Bug reports">🐛</a> <a href="#ideas-lasconic" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/lasconic/finary_uapi/commits?author=lasconic" title="Documentation">📖</a></td>
156
+ <td align="center" valign="top" width="16.66%"><a href="http://varal7.fr"><img src="https://avatars.githubusercontent.com/u/8019486?v=4?s=100" width="100px;" alt="Victor Quach"/><br /><sub><b>Victor Quach</b></sub></a><br /><a href="https://github.com/lasconic/finary_uapi/commits?author=Varal7" title="Code">💻</a></td>
157
+ </tr>
158
+ </tbody>
159
+ </table>
160
+
161
+ <!-- markdownlint-restore -->
162
+ <!-- prettier-ignore-end -->
163
+
164
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
165
+
166
+
167
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
@@ -14,7 +14,7 @@ If you don't already have an account, here is a referral link to sign up: https:
14
14
 
15
15
  ## Quick start
16
16
 
17
- 1. Install requirements. `pip install -r requirements.txt`.
17
+ 1. Install requirements. `pip install finary_uapi`.
18
18
  2. Copy paste the `credentials.json.tpl` file to `credentials.json` and file your username and password.
19
19
  3. Run `python -m finary_uapi signin`
20
20
  4. You are good to go and can explore the API. Run `python -m finary_uapi` for available commands.
@@ -119,3 +119,32 @@ python -m finary_uapi dashboard gross all | jq '.result["total"]["amount"]'
119
119
  ### Remarks for finary devs
120
120
  * Delete responses should be normalized, sometimes we get json back sometimes nothing but the 204 HTTP code.
121
121
 
122
+
123
+
124
+ ## Contributors ✨
125
+
126
+ <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
127
+ [![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)
128
+ <!-- ALL-CONTRIBUTORS-BADGE:END -->
129
+
130
+ Thanks go to these people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
131
+
132
+ <!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
133
+ <!-- prettier-ignore-start -->
134
+ <!-- markdownlint-disable -->
135
+ <table>
136
+ <tbody>
137
+ <tr>
138
+ <td align="center" valign="top" width="16.66%"><a href="http://lasconic.com"><img src="https://avatars.githubusercontent.com/u/234271?v=4?s=100" width="100px;" alt="Nicolas Froment"/><br /><sub><b>Nicolas Froment</b></sub></a><br /><a href="#projectManagement-lasconic" title="Project Management">📆</a> <a href="#promotion-lasconic" title="Promotion">📣</a> <a href="https://github.com/lasconic/finary_uapi/commits?author=lasconic" title="Code">💻</a> <a href="https://github.com/lasconic/finary_uapi/issues?q=author%3Alasconic" title="Bug reports">🐛</a> <a href="#ideas-lasconic" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/lasconic/finary_uapi/commits?author=lasconic" title="Documentation">📖</a></td>
139
+ <td align="center" valign="top" width="16.66%"><a href="http://varal7.fr"><img src="https://avatars.githubusercontent.com/u/8019486?v=4?s=100" width="100px;" alt="Victor Quach"/><br /><sub><b>Victor Quach</b></sub></a><br /><a href="https://github.com/lasconic/finary_uapi/commits?author=Varal7" title="Code">💻</a></td>
140
+ </tr>
141
+ </tbody>
142
+ </table>
143
+
144
+ <!-- markdownlint-restore -->
145
+ <!-- prettier-ignore-end -->
146
+
147
+ <!-- ALL-CONTRIBUTORS-LIST:END -->
148
+
149
+
150
+ This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!
@@ -0,0 +1,11 @@
1
+ # Getting started
2
+
3
+ 1. Install [`poetry`](https://python-poetry.org/) which manages the project dependencies, and get all dependencies needed to work on this project:
4
+ ```sh
5
+ pip3 install poetry && poetry check && poetry install
6
+ ```
7
+ 2. Use `./check.sh` to check the syntax, reindent and code guidelines
8
+ 3. Run tests with
9
+ ```sh
10
+ poetry run pytest
11
+ ```
@@ -7,7 +7,7 @@ You can always get the latest version of this module at:
7
7
  https://github.com/lasconic/finary-uapi
8
8
  """
9
9
 
10
- __version__ = "0.1.2"
10
+ __version__ = "0.1.4"
11
11
  __author__ = "lasconic"
12
12
  __copyright__ = """
13
13
  Copyright (c) 2021-2022, lasconic
@@ -17,6 +17,7 @@ Usage:
17
17
  finary_uapi real_estates [all | 1w | 1m | ytd | 1y]
18
18
  finary_uapi startups
19
19
  finary_uapi investments
20
+ finary_uapi investments dividends
20
21
  finary_uapi crowdlendings
21
22
  finary_uapi crowdlendings distribution
22
23
  finary_uapi cryptos
@@ -58,6 +59,8 @@ Usage:
58
59
  finary_uapi import crypto_csv FILENAME [(--new=NAME | --edit=account_id | --add=account_id)]
59
60
  finary_uapi import stocks_csv FILENAME [(--new=NAME | --edit=account_id | --add=account_id)] [-d]
60
61
  finary_uapi import stocks_json FILENAME [(--new=NAME | --edit=account_id | --add=account_id)] [-d]
62
+ finary_uapi sharing SHARING_CODE_OR_URL [--secret=SECRET_CODE]
63
+
61
64
 
62
65
  Options:
63
66
  --new=NAME Create a new account and import the lines
@@ -86,10 +89,11 @@ from .importers.crypto_generic_csv import import_crypto_generic_csv
86
89
  from .importers.stocks_generic_csv import import_stocks_generic_csv
87
90
  from .institutions import get_institutions
88
91
  from .user_portfolio import (
89
- get_portfolio_cryptos_distribution,
90
92
  get_portfolio_investments,
93
+ get_portfolio_investments_dividends,
91
94
  get_portfolio_crowdlendings,
92
95
  get_portfolio_crowdlendings_distribution,
96
+ get_portfolio_cryptos_distribution,
93
97
  )
94
98
  from .precious_metals import get_precious_metals
95
99
  from .user_generic_assets import (
@@ -102,6 +106,7 @@ from .user_real_estates import get_user_real_estates
102
106
  from .user_scpis import get_user_scpis
103
107
  from .scpis import get_scpis
104
108
  from .securities import get_securities
109
+ from .sharing import get_sharing
105
110
  from .signin import signin
106
111
  from .user_startups import get_user_startups
107
112
  from .user_cryptos import (
@@ -295,7 +300,10 @@ def main() -> int: # pragma: nocover
295
300
  else:
296
301
  result = get_user_cryptos(session)
297
302
  elif args["investments"]:
298
- result = get_portfolio_investments(session)
303
+ if args["dividends"]:
304
+ result = get_portfolio_investments_dividends(session)
305
+ else:
306
+ result = get_portfolio_investments(session)
299
307
  elif args["holdings_accounts"]:
300
308
  if args["<account_name>"]:
301
309
  result = get_holdings_account_per_name_or_id(
@@ -391,6 +399,8 @@ def main() -> int: # pragma: nocover
391
399
  add_imported_securities_to_account(
392
400
  session, args["--add"], to_be_imported, dry_run=args["-d"]
393
401
  )
402
+ elif args["sharing"]:
403
+ result = get_sharing(args["SHARING_CODE_OR_URL"], args["--secret"] or "")
394
404
  if result:
395
405
  print(json.dumps(result, indent=4))
396
406
 
@@ -20,6 +20,7 @@ def get_currencies(session: requests.Session, type: str, query: str):
20
20
  return x.json()
21
21
 
22
22
 
23
+ # utils functions
23
24
  def get_cryptocurrency_by_code(session: requests.Session, code: str):
24
25
  currencies = get_currencies(session, "crypto", code)
25
26
  if len(currencies["result"]) > 0:
@@ -16,7 +16,9 @@ def get_securities(session: requests.Session, query):
16
16
  logging.debug(json.dumps(x.json(), indent=4))
17
17
  result = x.json()
18
18
  else:
19
- logging.warn(f"Error searching for [{query}]. Status code = [{x.status_code}]")
19
+ logging.warning(
20
+ f"Error searching for [{query}]. Status code = [{x.status_code}]"
21
+ )
20
22
  result = {"result": []}
21
23
  return result
22
24
 
@@ -0,0 +1,25 @@
1
+ import json
2
+ import logging
3
+ import requests
4
+ from typing import Any
5
+
6
+ from .constants import API_ROOT
7
+
8
+
9
+ def get_sharing(sharing_code_url: str = "", secret_code: str = "") -> Any:
10
+ sharing_code = sharing_code_url.strip()
11
+ if sharing_code.startswith("http"):
12
+ s_array = sharing_code.split("/")
13
+ if "share" in s_array:
14
+ sharing_code = s_array[s_array.index("share") + 1]
15
+ if not sharing_code.isalnum():
16
+ logging.debug("sharing code is not well formatted")
17
+ return {}
18
+ sharing_url = f"{API_ROOT}/sharing/{sharing_code}"
19
+ session = requests.Session()
20
+ params = {}
21
+ if secret_code:
22
+ params["code"] = secret_code
23
+ x = session.get(sharing_url, params=params)
24
+ logging.debug(json.dumps(x.json(), indent=4))
25
+ return x.json()
@@ -13,3 +13,13 @@ def get_user_me(session: requests.Session) -> Any:
13
13
  def get_user_me_institution_connections(session: requests.Session) -> Any:
14
14
  url = f"{API_ROOT}/users/me/institution_connections/details"
15
15
  return get_and_print(session, url)
16
+
17
+
18
+ def get_user_me_sharing_links(session: requests.Session) -> Any:
19
+ url = f"{API_ROOT}/users/me/sharing_links"
20
+ return get_and_print(session, url)
21
+
22
+
23
+ def get_user_me_subscription_details(session: requests.Session) -> Any:
24
+ url = f"{API_ROOT}/users/me/subscription_details"
25
+ return get_and_print(session, url)
@@ -66,3 +66,9 @@ def get_portfolio_distribution(
66
66
  x = session.get(url, params=params)
67
67
  logging.debug(json.dumps(x.json(), indent=4))
68
68
  return x.json()
69
+
70
+
71
+ def get_portfolio_investments_dividends(session: requests.Session):
72
+ portfolio_type = "investments"
73
+ url = f"{portfolio_api}/{portfolio_type}/dividends"
74
+ return get_and_print(session, url)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "finary-uapi"
3
- version = "0.1.2"
3
+ version = "0.1.4"
4
4
  description = "Finary API client and command line tool to interact with your Finary account."
5
5
  authors = ["lasconic <lasconic@gmail.com>"]
6
6
  license = "MIT License"
@@ -20,10 +20,10 @@ mypy = "1.3.0"
20
20
  pdoc3 = "0.10.0"
21
21
  pydocstyle = "6.3.0"
22
22
  pytest = "7.3.1"
23
- pytest-cov = "4.0.0"
23
+ pytest-cov = "4.1.0"
24
24
  pytest-dependency = "0.5.1"
25
25
  responses = "0.23.1"
26
- types-requests = "2.30.0.0"
26
+ types-requests = "2.31.0.1"
27
27
 
28
28
  [build-system]
29
29
  requires = ["poetry-core"]
File without changes