GithubHelp home page GithubHelp logo

Comments (3)

vsudilov avatar vsudilov commented on May 26, 2024

Hi Christophe,

Thanks for catching this unintuitive behavior!

Could you explain a bit more your workflow regarding setting/updating tokens? setting ads.config.token was meant as a one-time initialization step in the same way as setting environmental variables or writing to those config files. One can always make the query object and set the token on that directly after instantiation:

query = ads.SearchQuery(q='q')
q.token = 'token'

but maybe there's a better way for your use case that we can support.

from ads.

Morisset avatar Morisset commented on May 26, 2024

Hi Vladimir,
For unknown reasons, in the print_results in my program (https://github.com/Morisset/SNI_ads), when I use some methods of papers objects (still don't know which one), it calls ADS. It should not, as all the values have been downloaded in previous stage and this method is only a printing one. I also realized that the program is working very well without any connection (this goes in the direction that everything was known before entering this method), so when entering the method I store the token in some variable and then do
ads.config.token = ''
The rest of the program runs and at the end I reset the token to the original value. But I realized that when I have the ADS_DEV_KEY environment variable defined, it does not take into account the trick and connect to ADS, burning some of the 5000 tickets/day I have. It may be an is one print a lot of time.

I was thinking that the token from ads.config was a variable (or even a property) and that changing its value would change the behavior.

from ads.

vsudilov avatar vsudilov commented on May 26, 2024

For the reasons stated above and that it seems your issue's root cause was issue #38, I won't be refactoring ads.config.token. I've added a optional token kwarg to the SearchQuery constructor that will set the token at init. I think that should be fine for workflows that require changing tokens frequently.

from ads.

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.