Example #1
0
def test_login(betamax_session: requests.Session):
    real_init = Geocaching.__init__

    def fake_init(self_, unused_argument=None):
        real_init(self_, session=betamax_session)

    # patching with the fake init method above to insert our session into the Geocaching object for testing
    with patch.object(Geocaching, "__init__", new=fake_init):
        pycaching.login(USERNAME, PASSWORD)
Example #2
0
    def test_login(self):
        real_init = Geocaching.__init__

        def fake_init(self_, unused_argument=None):
            real_init(self_, session=self.session)

        # patching with the fake init method above to insert our session into the Geocaching object for testing
        with patch.object(Geocaching, '__init__', new=fake_init):
            with self.recorder.use_cassette('geocaching_shortcut_login'):
                pycaching.login(_username, _password)
    def test_login(self):
        real_init = Geocaching.__init__

        def fake_init(self_, unused_argument=None):
            real_init(self_, session=self.session)

        # patching with the fake init method above to insert our session into the Geocaching object for testing
        with patch.object(Geocaching, '__init__', new=fake_init):
            with self.recorder.use_cassette('geocaching_shortcut_login'):
                pycaching.login(_username, _password)
Example #4
0
def main():
    url = input("URL: ")
    cacheurl = url
    cachegccode = url.split("/")[4].split("_")[0]

    geocaching = pycaching.login("USERNAME", "PASSWORD")
    cache = geocaching.get_cache(cachegccode)
    cachecreator = cache.author

    lat = str(cache.lat)
    lon = str(cache.lon)
    cachename = str(cache.name)
    cacheid = str(cache.id)
    cachetype = str(str(cache.type).split(".")[1].title())
    cachedifficulty = str(cache.difficulty)
    if cachedifficulty.split(".")[1] == "0":
        cachedifficulty = cachedifficulty.split(".")[0]
    cachecontainer = str(str(cache.size).split(".")[1].title())
    cacheterrain = str(cache.terrain)
    if cacheterrain.split(".")[1] == "0":
        cacheterrain = cacheterrain.split(".")[0]
    country = str(cache.country)
    state = str(cache.stateprovince)
    longdesc = str(cache.description)
    shortdesc = str(cache.summary)
    hints = str(cache.hint)

    createGPX(cachecreator, "", "", "", lat, lon, cachegccode, cachename,
              cacheid, cachetype, cachedifficulty, cachecontainer,
              cacheterrain, country, state, longdesc, shortdesc, hints,
              cacheurl)

    resp = input("Another? (Y/N): ")

    resp = resp.lower()
    if "y" in resp:
        main()
    else:
        exit(0)
Example #5
0
 def test_login(self):
     pycaching.login(_username, _password)
Example #6
0
 def test_login(self):
     pycaching.login(_username, _password)
Example #7
0
targetlogdata = 'logdata'+timestamp+'.csv'
targetcachedata = 'cachedata'+timestamp+'.csv'

# file name declarations
cachelist_file = "gc_cachelist.txt"
# "logdata.csv"
if path.isfile("logdata.csv"):
  print("logdata.csv exists, creating copy", targetlogdata)
  os.rename('logdata.csv', targetlogdata)
# cachedata.csv
if path.isfile("cachedata.csv"):
  print("cachedata.csv exists, creating copy ", targetcachedata)
  os.rename('cachedata.csv', targetcachedata)

try:
     geocaching = pycaching.login()
except pycaching.errors.LoginFailedException as inst:
     print('Login Failed:',inst)
     sys.exit()     

except Exception as inst:
     print(inst)              # __str__ allows args to be printed directly
     print('exit')
     sys.exit()
except:
     sys.exit()  

# read file with Geocache codes if it exists


if path.isfile(cachelist_file):