Skip to content

Commit

Permalink
set urllib user-agent
Browse files Browse the repository at this point in the history
  • Loading branch information
obfusk authored Mar 5, 2021
1 parent 9c4fff9 commit 5e70d17
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pythonforandroid/recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sh
import shutil
import fnmatch
import urllib
from urllib.request import urlretrieve
from os import listdir, unlink, environ, mkdir, curdir, walk
from sys import stdout
Expand All @@ -23,6 +24,12 @@
from pythonforandroid.util import load_source as import_recipe


# jqueryui.com returns a 403 w/ the default user agent
url_opener = urllib.request.build_opener()
url_opener.addheaders = [('User-agent', 'Mozilla/5.0')]
urllib.request.install_opener(url_opener)


class RecipeMeta(type):
def __new__(cls, name, bases, dct):
if name != 'Recipe':
Expand Down

0 comments on commit 5e70d17

Please sign in to comment.