Skip to main content

Python Avanza API

Project description

Smaland - Avanza API python wrapper

This is an unofficial python wrapper for the Avanza API. I am in no way affiliated with Avanza, using Smaland may violate the Avanza terms of service.

Installation

Install via pip

$ pip install smaland

TOTP Secret

To log in through Smaland to Avanza, you need the TOTP Secret and log in with 2FA. To get the secret:

  1. Go to Mina Sidor > Profil > Sajtinställningar > Tvåfaktorsinloggning and click "Återaktivera". (Only do this step if you have already set up two-factor auth.)
  2. Click "Aktivera" on the next screen.
  3. Select "Annan app för tvåfaktorsinloggning".
  4. Click "Kan du inte scanna QR-koden?" to reveal your TOTP Secret.
  5. Save the 2FA secret in a safe place, preferably a password manager.
  6. Temporarly save you avanza username, password, and secrit to a .env file (and add the .env file to your .gitignore)
username_av=my_username
password_av=my_password
secret_av=my_secret
  1. When logging into Avanza through Smaland, enter the credentials as:
from smaland import Smaland
import dotenv
import os

#Load environment variables 
dotenv.load_dotenv()

credentials = {
    "username" : os.getenv("username_av"),
    "password" : os.getenv("password_av"),
    "secret" : os.getenv("secret_av")
}

sl = Smaland()
sl.authenticate(credentials)

LICENSE

MIT license. See the LICENSE file for details.

RESPONSIBILITIES

The author of this software is not responsible for any indirect damages (foreseeable or unforeseeable), such as, if necessary, loss or alteration of or fraudulent access to data, accidental transmission of viruses or of any other harmful element, loss of profits or opportunities, the cost of replacement goods and services or the attitude and behavior of a third party.

Acknowledgment

This wrapper was inspired by the node Avanza-api, where the author did a great job in finding all the endpoints etc. Thank you!

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

smaland-0.0.6.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

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

smaland-0.0.6-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file smaland-0.0.6.tar.gz.

File metadata

  • Download URL: smaland-0.0.6.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6

File hashes

Hashes for smaland-0.0.6.tar.gz
Algorithm Hash digest
SHA256 88e7ddbffdd9f24bb06bc7f7a1157627d6407093ffc21e95a700a7801e98e9c6
MD5 2eb8f65268830e64967a953dfec22532
BLAKE2b-256 591399297c4eb7b813708da015ad118f730022728003a131a795b73f2ba0a3a4

See more details on using hashes here.

File details

Details for the file smaland-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: smaland-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0.post20200210 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.6

File hashes

Hashes for smaland-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 5f6e35361de54cd8db568539c397ba267eb7b4b66c227ccef1ea52a72e34a109
MD5 394f9adf4f8ca04f11c67757512a75a4
BLAKE2b-256 eb876af571d42328a3fcbc5d6c35db8c43d98a757a02bf97c70d6721b8967bd4

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