Skip to content

Commit

Permalink
Added missing parameter "systemID" in Tripwire requests
Browse files Browse the repository at this point in the history
- Missing parameter "systemID" in Tripwire requests generated warning in server logs

- Modified requests user agent and renamed it to Pathfinder

- Fixed false message of invalid user/pass if no Tripwire signatures exist, even though account info is correct
  • Loading branch information
Valtyr Farshield committed May 28, 2016
1 parent 7fb41d0 commit b506234
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pathfinder/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

__organization__ = "FarshieldTech"
__appname__ = "Pathfinder"
__version__ = "0.1.0"
__version__ = "0.1.1"
__author__ = "Valtyr Farshield"
2 changes: 2 additions & 0 deletions src/pathfinder/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,8 @@ def thread_done(self, connections):

if connections > 0:
self._trip_message("Retrieved {} connections!".format(connections), MainWindow.MSG_OK)
elif connections == 0:
self._trip_message("No wormhole connections exist!", MainWindow.MSG_ERROR)
else:
self._trip_message("Error. Check url/user/pass.", MainWindow.MSG_ERROR)

Expand Down
23 changes: 19 additions & 4 deletions src/pathfinder/model/tripwire.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class Tripwire:
"""
Tripwire handler
"""
USER_AGENT = "Pathfinder v0.1.1"

def __init__(self, eve_db, username, password, url):
self.eve_db = eve_db
Expand All @@ -30,12 +31,16 @@ def login(self):
"username": self.username,
"password": self.password
}
headers = {
"Referer": login_url,
"User-Agent": Tripwire.USER_AGENT,
}

try:
result = session_requests.post(
login_url,
data=payload,
headers=dict(referer=login_url)
headers=headers
)
except requests.exceptions.RequestException:
logging.warning("Unable to connect to Tripwire")
Expand All @@ -51,13 +56,19 @@ def get_chain(self):
if self.session_requests:
refresh_url = urlparse.urljoin(self.url, "refresh.php")
payload = {
"mode": "init"
"mode": "init",
"systemID": "30000142"
}
headers = {
"Referer": refresh_url,
"User-Agent": Tripwire.USER_AGENT,
}

try:
result = self.session_requests.get(
refresh_url,
params=payload
params=payload,
headers=headers
)
except requests.exceptions.RequestException as e:
logging.error(e, exc_info=True)
Expand All @@ -69,10 +80,14 @@ def get_chain(self):
return response

def augment_map(self, solar_map):
connections = 0
connections = -1 # not logged in, yet
chain = self.get_chain()

if chain:
# we get some sort of response so at least we're logged in
connections = 0

# let's see how many wormhole signatures exist (if any...)
for sig in chain["chain"]["map"]:
if sig["type"] != "GATE":
connections += 1
Expand Down

0 comments on commit b506234

Please sign in to comment.