Skip to content

Commit

Permalink
RF: Rename Session.http to Session.session
Browse files Browse the repository at this point in the history
  • Loading branch information
TEParsons committed May 13, 2022
1 parent 5c036c0 commit 22963a9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions psychopy/projects/pavlovia.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def __init__(self, id, rememberMe=True):
# Get info from Pavlovia
if isinstance(id, (float, int, str)):
# If given a number or string, treat it as a user ID / username
self.info = self.session.http.get(
self.info = self.session.session.get(
"https://pavlovia.org/api/v2/designers/" + str(id)
).json()['designer']
# Make sure self.info has necessary keys
Expand Down Expand Up @@ -410,16 +410,16 @@ def startSession(self, token):
self.userFullName = self.gitlab.user.name
self.authenticated = True
# Setup http session
self.http = requests.Session()
self.http.headers = {'OauthToken': token}
self.session = requests.Session()
self.session.headers = {'OauthToken': token}
else:
# Setup gitlab session
if parse_version(gitlab.__version__) > parse_version("1.4"):
self.gitlab = gitlab.Gitlab(rootURL, timeout=10, per_page=100)
else:
self.gitlab = gitlab.Gitlab(rootURL, timeout=10)
# Setup http session
self.http = requests.Session()
self.session = requests.Session()

@property
def user(self):
Expand Down Expand Up @@ -494,18 +494,18 @@ def __init__(self, term, sortBy=None, filterBy=None, mine=False):
session = getCurrentSession()
if mine:
# Display experiments by current user
data = session.http.get(
data = session.session.get(
f"https://pavlovia.org/api/v2/designers/{session.userID}/experiments?search={term}{filterBy}",
timeout=10
).json()
elif term or filterBy:
data = session.http.get(
data = session.session.get(
f"https://pavlovia.org/api/v2/experiments?search={term}{filterBy}",
timeout=10
).json()
else:
# Display demos for blank search
data = session.http.get(
data = session.session.get(
"https://pavlovia.org/api/v2/experiments?search=demos&designer=demos",
timeout=10
).json()
Expand Down Expand Up @@ -617,7 +617,7 @@ def refresh(self):
self._info = None
# for a new project it may take time for Pavlovia to register the new ID so try for a while
while self._info is None and (time.time() - start) < 30:
requestVal = self.session.http.get(
requestVal = self.session.session.get(
f"https://pavlovia.org/api/v2/experiments/{self.project.id}",
).json()
self._info = requestVal['experiment']
Expand Down

0 comments on commit 22963a9

Please sign in to comment.