Skip to content

Commit

Permalink
Shorten API timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Ruys committed Jan 11, 2017
1 parent af754a9 commit 6950a8b
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
5 changes: 5 additions & 0 deletions gw2pvo/average.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import logging

__author__ = "Mark Ruys"
__copyright__ = "Copyright 2017, Mark Ruys"
__license__ = "MIT"
__email__ = "[email protected]"

class MovingAverage:

def __init__(self, n):
Expand Down
7 changes: 6 additions & 1 deletion gw2pvo/gw_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
import datetime
import requests

__author__ = "Mark Ruys"
__copyright__ = "Copyright 2017, Mark Ruys"
__license__ = "MIT"
__email__ = "[email protected]"

class GoodWeApi:

def __init__(self, system_id):
Expand Down Expand Up @@ -86,7 +91,7 @@ def call(self, url, payload):
return json
except requests.exceptions.RequestException as exp:
logging.warning(exp)
time.sleep(30)
time.sleep(3)
else:
logging.error("Failed to call GoodWe API")

Expand Down
5 changes: 5 additions & 0 deletions gw2pvo/gw_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import datetime
import csv

__author__ = "Mark Ruys"
__copyright__ = "Copyright 2017, Mark Ruys"
__license__ = "MIT"
__email__ = "[email protected]"

class GoodWeCSV:

def __init__(self, filename):
Expand Down
2 changes: 2 additions & 0 deletions gw2pvo/gw_scraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import time
from html.parser import HTMLParser

# Deprecated
#
# Note that this file is not used anymore as the JSON variant is more reliable.

class GwHTMLParser(HTMLParser):
Expand Down
7 changes: 6 additions & 1 deletion gw2pvo/pvo_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import time
import requests

__author__ = "Mark Ruys"
__copyright__ = "Copyright 2017, Mark Ruys"
__license__ = "MIT"
__email__ = "[email protected]"

class PVOutputApi:

def __init__(self, system_id, api_key):
Expand Down Expand Up @@ -67,7 +72,7 @@ def call(self, url, payload):
break
except requests.exceptions.RequestException as arg:
logging.warning(arg)
time.sleep(30)
time.sleep(3)
else:
logging.error("Failed to call PVOutput API")

0 comments on commit 6950a8b

Please sign in to comment.