MCPcopy Index your code
hub / github.com/csev/py4e / urlopen

Function urlopen

code3/giturl.py:9–31  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

7ctx.verify_mode = ssl.CERT_NONE
8
9def urlopen(url):
10 secrets = gitsecrets.secrets()
11
12 parms = urllib.parse.urlencode(secrets)
13
14 if url.find('?') > 0 :
15 url = url + '&'
16 else:
17 url = url + '?'
18
19 url = url + parms
20
21 # print('Retrieving', url)
22 req = urllib.request.Request(
23 url,
24 data=None,
25 headers={'User-Agent': 'giturl.py from www.py4e.com/code3'
26 }
27 )
28 connection = urllib.request.urlopen(req, context=ctx)
29 str_json = connection.read().decode()
30 headers = dict(connection.getheaders())
31 return (str_json, headers)
32

Callers 3

urllink2.pyFile · 0.85
twspider.pyFile · 0.85
spider.pyFile · 0.85

Calls 3

readMethod · 0.80
findMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected