RPI2026F1 added a comment.

  I am asking that when I login as a user, it can be stored as an object. I 
have written a script that is not ran by the `pwb` wrapper script, and it will 
not function without a `user-config.py` file. I am not interested in adding the 
pywikibot argument parsing logic to my script, so I have intentionally avoided 
loading it through that since I have my own parsing logic with `argparse`. What 
I would like is a `pywikibot.login(username, password)`, 
`pywikibot.login(username, oauth_consumer_key=...)`, and maybe for OAuth2 a 
`pywikibot.oauth2_login(access_token)` method. All of these should return some 
form of `pywikibot.Login` object which I can pass along to `pywikibot.Site`. 
Basically, I am looking for a way to sign in where if I login inside a 
function, that login does not persist outside of the stack of the function. 
Hypothetically:
  
    def do_something():
        login = pywikibot.login(username, password)
        site = pywikibot.Site("wikidata", "wikidata", login=login)
        // Do my wikidata things here
    
    def main():
        do_something()
        site = pywikibot.Site("wikidata", "wikidata")
        pywikibot.ItemPage(site, "Q1").addClaim(...) // Error: Not logged in!

TASK DETAIL
  https://phabricator.wikimedia.org/T323852

EMAIL PREFERENCES
  https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: RPI2026F1
Cc: Xqt, Aklapper, pywikibot-bugs-list, RPI2026F1, PotsdamLamb, Jyoo1011, 
JohnsonLee01, SHEKH, Dijkstra, Khutuck, Zkhalido, Viztor, Wenyi, Tbscho, MayS, 
Mdupont, JJMC89, Dvorapa, Altostratus, Avicennasis, mys_721tx, jayvdb, Masti, 
Alchimista
_______________________________________________
pywikibot-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to