Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ParsePy
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ParsePy
Commits
8268c9f6
Commit
8268c9f6
authored
Aug 04, 2014
by
Andres Buritica
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add timeout to urlopen
- Connection can sometimes hang forever on SSL handshake
parent
30ab2e11
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletions
+3
-1
parse_rest/connection.py
+3
-1
No files found.
parse_rest/connection.py
View file @
8268c9f6
...
@@ -23,6 +23,8 @@ API_ROOT = 'https://api.parse.com/1'
...
@@ -23,6 +23,8 @@ API_ROOT = 'https://api.parse.com/1'
ACCESS_KEYS
=
{}
ACCESS_KEYS
=
{}
CONNECTION_TIMEOUT
=
60
def
register
(
app_id
,
rest_key
,
**
kw
):
def
register
(
app_id
,
rest_key
,
**
kw
):
global
ACCESS_KEYS
global
ACCESS_KEYS
ACCESS_KEYS
=
{
ACCESS_KEYS
=
{
...
@@ -87,7 +89,7 @@ class ParseBase(object):
...
@@ -87,7 +89,7 @@ class ParseBase(object):
request
.
get_method
=
lambda
:
http_verb
request
.
get_method
=
lambda
:
http_verb
try
:
try
:
response
=
urlopen
(
request
)
response
=
urlopen
(
request
,
timeout
=
CONNECTION_TIMEOUT
)
except
HTTPError
as
e
:
except
HTTPError
as
e
:
exc
=
{
exc
=
{
400
:
core
.
ResourceRequestBadRequest
,
400
:
core
.
ResourceRequestBadRequest
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment