Skip to content

Commit

Permalink
Merge pull request #1 from slowpokefarm/master
Browse files Browse the repository at this point in the history
Proxy protocols support
  • Loading branch information
ohld authored Nov 1, 2017
2 parents dcba670 + c615134 commit e6cc227
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions api.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@
from .prepare import get_credentials
from .prepare import delete_credentials

try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse

# The urllib library was split into other modules from Python 2 to Python 3
if sys.version_info.major == 3:
import urllib.parse
Expand Down Expand Up @@ -77,9 +82,11 @@ def login(self, username=None, password=None, force=False, proxy=None):
if (not self.isLoggedIn or force):
self.session = requests.Session()
if self.proxy is not None:
parsed = urlparse(self.proxy)
scheme = 'http://' if not parsed.scheme else ''
proxies = {
'http': 'http://' + self.proxy,
'https': 'http://' + self.proxy,
'http': scheme + self.proxy,
'https': scheme + self.proxy,
}
self.session.proxies.update(proxies)
if (
Expand Down Expand Up @@ -636,7 +643,7 @@ def getTotalUserFeed(self, usernameId, minTimestamp=None):
if "more_available" not in temp or temp["more_available"] is False:
return user_feed
next_max_id = temp["next_max_id"]

def getTotalHashtagFeed(self, hashtagString, amount=100):
hashtag_feed = []
next_max_id = ''
Expand Down

0 comments on commit e6cc227

Please sign in to comment.