Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite user-agent handling #638

Closed
dpriskorn opened this issue Dec 7, 2023 · 4 comments
Closed

Rewrite user-agent handling #638

dpriskorn opened this issue Dec 7, 2023 · 4 comments
Assignees

Comments

@dpriskorn
Copy link
Contributor

dpriskorn commented Dec 7, 2023

Hi, I wrote https://github.com/dpriskorn/LexDanNet today and it complained about user agent.

I really dislike the dictionary thing because it is not easy to handle with classes.

I want helper methods instead to set all the necessary parameters.

Perhaps on the Login object which could be renamed to WikibaseConnection?

@dpriskorn dpriskorn changed the title Helper method to determine if WBI is logged in Rewrite user-agent handling Dec 7, 2023
@LeMyst
Copy link
Owner

LeMyst commented Dec 9, 2023

Hello @dpriskorn ,

I'm not against having an helper method for this, but did you test to put the wbi_config['...'] = '...' just below the imports, outside any class/method ?

from wikibaseintegrator import wbi_login
from wikibaseintegrator.wbi_config import config as wbi_config

wbi_config['MEDIAWIKI_API_URL'] = 'http://localhost/api.php'

class SomeThird():
    def main(self):
        # This part fail because MEDIAWIKI_API_URL is not a valid URL
        wbi_login.Login(user='adminqsdsqdsqdsqd', password='change-this-password')


third = SomeThird()
third.main()

@dpriskorn
Copy link
Contributor Author

Yes, that solved it.

@LeMyst
Copy link
Owner

LeMyst commented Dec 12, 2023

Yes, that solved it.

Thanks, but does this solution is good for you?

@dpriskorn
Copy link
Contributor Author

yes, lets keep it like this for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants