Git Product home page Git Product logo

Comments (5)

mkb79 avatar mkb79 commented on May 24, 2024 1

You can extend the Authenticator class this way:

from audible import Authenticator

class ExtendedAuthenticator(Authenticator):
    @classmethod
    def from_dict(cls, data: dict):
        auth = cls()
        auth.locale = data.pop("locale_code", None)
        if "login_cookies" in data:
            auth.website_cookies = data.pop("login_cookies")
        auth._update_attrs(**data)
        return auth

    def to_dict(self):
        data = {
            "website_cookies": self.website_cookies,
            "adp_token": self.adp_token,
            "access_token": self.access_token,
            "refresh_token": self.refresh_token,
            "device_private_key": self.device_private_key,
            "store_authentication_cookie": self.store_authentication_cookie,
            "device_info": self.device_info,
            "customer_info": self.customer_info,
            "expires": self.expires,
            "locale_code": self.locale.country_code,
            "activation_bytes": self.activation_bytes
        }
        return data

Now you have the possibility to export the data as a dict and create a new instance from ExtendedAuthenticator from dict! You can now store the data in a way you like!

from audible.

mkb79 avatar mkb79 commented on May 24, 2024

Hi. The to_file and from_file classmethods take a pathlib.Path or string instance to present the file.

You can add a custom class method to override this behave. If you tell me, what you want to do, I can help you more.

from audible.

normal1ze avatar normal1ze commented on May 24, 2024

Ah right.

Because my instance hosting the library is ephemeral, when it gets scaled the files on the drive are removed and replaced. So I was thinking of storing the file either as blob in DB, blob storage, or in a secure S3 bucket.

from audible.

normal1ze avatar normal1ze commented on May 24, 2024

Oh wow thanks for your help. This is great!!

from audible.

mkb79 avatar mkb79 commented on May 24, 2024

I‘ve implement this function in audible now. You can test it now with pip install -i https://test.pypi.org/simple/ audible==0.7.1.dev1

from audible.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.