Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
interfect
funkwhale
Commits
206ae296
Verified
Commit
206ae296
authored
Apr 08, 2018
by
Eliot Berriot
Browse files
Ensure timeout in requests
parent
b8c7e960
Changes
4
Hide whitespace changes
Inline
Side-by-side
api/funkwhale_api/federation/activity.py
View file @
206ae296
...
...
@@ -73,6 +73,7 @@ def deliver(activity, on_behalf_of, to=[]):
auth
=
auth
,
json
=
activity
,
url
=
recipient_actor
.
inbox_url
,
timeout
=
5
,
headers
=
{
'Content-Type'
:
'application/activity+json'
}
...
...
api/funkwhale_api/federation/actors.py
View file @
206ae296
...
...
@@ -31,6 +31,7 @@ def remove_tags(text):
def
get_actor_data
(
actor_url
):
response
=
session
.
get_session
().
get
(
actor_url
,
timeout
=
5
,
headers
=
{
'Accept'
:
'application/activity+json'
,
}
...
...
@@ -42,6 +43,7 @@ def get_actor_data(actor_url):
raise
ValueError
(
'Invalid actor payload: {}'
.
format
(
response
.
text
))
def
get_actor
(
actor_url
):
data
=
get_actor_data
(
actor_url
)
serializer
=
serializers
.
ActorSerializer
(
data
=
data
)
...
...
api/funkwhale_api/federation/webfinger.py
View file @
206ae296
...
...
@@ -47,7 +47,7 @@ def get_resource(resource_string):
username
,
hostname
=
clean_acct
(
resource
,
ensure_local
=
False
)
url
=
'https://{}/.well-known/webfinger?resource={}'
.
format
(
hostname
,
resource_string
)
response
=
session
.
get_session
().
get
(
url
)
response
=
session
.
get_session
().
get
(
url
,
timeout
=
5
)
response
.
raise_for_status
()
serializer
=
serializers
.
ActorWebfingerSerializer
(
data
=
response
.
json
())
serializer
.
is_valid
(
raise_exception
=
True
)
...
...
api/funkwhale_api/music/views.py
View file @
206ae296
...
...
@@ -218,6 +218,7 @@ class TrackFileViewSet(viewsets.ReadOnlyModelViewSet):
library_track
.
audio_url
,
auth
=
auth
,
stream
=
True
,
timeout
=
20
,
headers
=
{
'Content-Type'
:
'application/activity+json'
})
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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