Git Product home page Git Product logo

Comments (9)

mkb79 avatar mkb79 commented on May 24, 2024

That sounds really strange. I tried downloading several books as aax and aaxc today and all is running as expected.

Which marketplace you are using? The book you are trying to download is a book you have bought?

Can you try my audible-cli package?

from audible.

CuriousEl3phant502 avatar CuriousEl3phant502 commented on May 24, 2024

Yeah it is strange. I have not seen this before. Sure I can try the cli. It was 3 different books I bought and a couple "included" ones- all had the same issue. Those were all of the ones i tried. It was from the US marketplace.

from audible.

CuriousEl3phant502 avatar CuriousEl3phant502 commented on May 24, 2024

So i pulled down a new copy of the regular audible project (0.5.4), and retried the example code. Still 403. However, when I setup the cli (0.5.3) project it worked. Assuming nothing significant in the two minor versions, it looks like the difference is httpx.AsyncClient.stream vs httpx.stream. It seems maybe the audible service changed. Before the URL params given by audible were enough to authenticate/authorize, but now it is not the case.

Also, even in your cli project the download URL says its for an aax file even though I was requesting an aaxc file.

from audible.

mkb79 avatar mkb79 commented on May 24, 2024

I saw in your opening post that you wrote with httpx.stream("GET", url) as r:. This means the request is not authenticated.

Can you try the following:

auth = audible.Authenticator.from_file(…)

with httpx.stream("GET", url, auth=auth) as r:

from audible.

CuriousEl3phant502 avatar CuriousEl3phant502 commented on May 24, 2024

This gives a 403 as well. For some reason you need to use a client/async client object now-

auth = audible.Authenticator.from_file(…)

with httpx.Client(auth=auth).stream("GET", url) as r:

Maybe you'll find some solution i didnt see, but this is the only way I've seen it work starting this month.

from audible.

jesseconnr avatar jesseconnr commented on May 24, 2024

It seems httpx.stream does not send some of the required headers that httpx.Client does. You can add the headers manually as seen in the example gist. I didn't find anything in the httpx github issues so I'm not sure if this is a bug or expected. Also, if you're using offline_url, the auth portion is not required.

https://gist.github.com/jesseconnr/18ab04422ad11a7b93c205a2f4f5fdb3

from audible.

mkb79 avatar mkb79 commented on May 24, 2024

Thank you booth for your very important information. I will take a look on the httpx source code.

FYI:
I‘m short on time this week but I will give my best.

from audible.

jesseconnr avatar jesseconnr commented on May 24, 2024

Here's some additional discovery on the httpx versions.

0.16.1 - missing headers (audible depends on 0.16.*)
0.18.1 - sends all headers (this is the latest version)
0.14.3 - also sends all headers (this is just a version an older project of mine was using)

If there aren't any breaking changes it could be as easy and updating the dependency but either way it's an easy thing to work around.

from audible.

mkb79 avatar mkb79 commented on May 24, 2024

@jesseconnr Thank you for your work! I've created a pr now to update httpx to 0.18.x for testing.

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.