Skip to content

Commit 5e70d17

Browse files
authored
set urllib user-agent
1 parent 9c4fff9 commit 5e70d17

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pythonforandroid/recipe.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import sh
1010
import shutil
1111
import fnmatch
12+
import urllib
1213
from urllib.request import urlretrieve
1314
from os import listdir, unlink, environ, mkdir, curdir, walk
1415
from sys import stdout
@@ -23,6 +24,12 @@
2324
from pythonforandroid.util import load_source as import_recipe
2425

2526

27+
# jqueryui.com returns a 403 w/ the default user agent
28+
url_opener = urllib.request.build_opener()
29+
url_opener.addheaders = [('User-agent', 'Mozilla/5.0')]
30+
urllib.request.install_opener(url_opener)
31+
32+
2633
class RecipeMeta(type):
2734
def __new__(cls, name, bases, dct):
2835
if name != 'Recipe':

0 commit comments

Comments
 (0)