Login

Simply call pycaching.login() method and it will do everything for you.

import pycaching geocaching = pycaching . login ( "user" , "pass" )

If you won’t provide an username or password, pycaching will try to load .gc_credentials file from current directory or home folder. It will try to parse it as JSON and use the keys username and password from that file as login credentials.

# sample .gc_credentials JSON file { "username" : "myusername" , "password" : "mypassword" }

You can also provide multiple username and password tuples in a file as login credentials. The tuple to be used can be chosen by providing its username when calling pycaching.login() , e.g. pycaching.login("myusername2") . The first username and password tuple specified will be used as default if pycaching.login() is called without providing a username.

# sample .gc_credentials JSON file with mutiple users [ { "username" : "myusername1" , "password" : "mypassword1" }, { "username" : "myusername2" , "password" : "mypassword2" } ]

import pycaching geocaching = pycaching . login () # assume the .gc_credentials file is presented

In case you have a password manager in place featuring a command line interface (e.g. GNU pass) you may specify a password retrieval command using the password_cmd key instead of password .

# sample .gc_credentials JSON file with password command { "username" : "myusername" , "password_cmd" : "pass geocaching.com/myUsername" }