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.4.tar.gz (10.9 kB view hashes)

Uploaded Source

Built Distribution

smaland-0.0.4-py3-none-any.whl (11.9 kB view hashes)

Uploaded Python 3

Supported by

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