Skip to content
This repository has been archived by the owner on Oct 9, 2020. It is now read-only.

Change in Mullvad's JSON output breaks api.py #2

Closed
RogueScholar opened this issue Apr 21, 2019 · 2 comments
Closed

Change in Mullvad's JSON output breaks api.py #2

RogueScholar opened this issue Apr 21, 2019 · 2 comments

Comments

@RogueScholar
Copy link

A recent change to Am I Mullvad's JSON output has flummoxed the module, specifically the decision to remove the blacklisted value. Not unpredictably, the mullpy invocation now produces:

$ mullpy                                                                                             
    Traceback (most recent call last):
    File "~/.local/bin/mullpy", line 10, in <module>
    sys.exit(main())
    File "~/.local/lib/python3.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
    File "~/.local/lib/python3.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
    File "~/.local/lib/python3.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
    File "~/.local/lib/python3.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
    File "~/.local/lib/python3.7/site-packages/mullvad_python/cli.py", line 12, in main
    mullpy = Mullpy()
    File "~/.local/lib/python3.7/site-packages/mullvad_python/api.py", line 32, in 
    __init__
    self.blacklisted = self.api_data['blacklisted']
    KeyError: 'blacklisted'

Executed using Python 3.7 system installation within Kubuntu 19.04 "Disco Dingo" atop Linux Kernel 5.0.13, running on a Lenovo ThinkPad T420s (Intel Core i7 2nd Gen., 8GB RAM). As advised in module README, installed version 0.3.1 of module using pip v19 with the --user flag. Both system and user default shell is configured as Zsh v5.5.1.

I almost submitted a stupidly simple PR removing that definition from api.py, but after a moment's reflection it seemed that the more forward-thinking approach would be to define an error handler that was able to react to future such changes by Mullvad by alerting the user via output to stderr to the missing value(s), then disregarding that value and rendering the stdout output with what still was available to the parser. If I had any Python chops I'd have written that PR instead, but alas I'm a PyNoob, so all you get is this bug report. 😜

To Reproduce
Issued following command in terminal emulator Yakuake configured to provide a shell from the command zsh -i

mullpy

Expected behavior
Normal output of command without any additional arguments, i.e.:

\  |         |  |               
|\/ |  |   |  |  |  __ \   |   | 
|   |  |   |  |  |  |   |  |   | 
_|  _| \__,_| _| _|  .__/  \__, | 
_|     ____/  
Using Mullvad:  True
Server Type:    Wireguard
IP Address:     185.232.22.59
Country:        New York, United States
Location:       -74.0052, 40.7214
Organization:   M247 Europe SRL
Blacklisted:    False
@franccesco
Copy link
Owner

I'm a PyNoob too! haha, thanks for the report, but it seems that Mullvad already fixed the issue. I'm connected to Mullvad's network right now. but it seems that everything is working correctly. Can you check again if you're having this issue?

@franccesco
Copy link
Owner

Closing due to inactivity.

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

No branches or pull requests

2 participants