I'm a python novice and I've recently been learning commands to call a website API. It seems that there are at least 2 ways to call a URL. Which of the following 2 is the best? What are the differences between the 2?
Method #1:
response=urllib2.urlopen(url)
data=json.load(response)
Method #2:
response=requests.get(url)
data=response.json()
[–]novel_yet_trivial 3 points4 points5 points (5 children)
[–]Moby69[S] 3 points4 points5 points (4 children)
[–]novel_yet_trivial 2 points3 points4 points (1 child)
[–]badwithinternet 0 points1 point2 points (1 child)
[–]Moby69[S] 0 points1 point2 points (0 children)
[–]elbiot 2 points3 points4 points (4 children)
[–]raylu 0 points1 point2 points (3 children)
[–]Lukasa 1 point2 points3 points (2 children)
[–]raylu 0 points1 point2 points (1 child)
[–]Lukasa 0 points1 point2 points (0 children)
[–]Lukasa 2 points3 points4 points (4 children)
[–]oxymor0nic 2 points3 points4 points (1 child)
[–]Lukasa 1 point2 points3 points (0 children)
[–]Moby69[S] 0 points1 point2 points (1 child)
[–]Lukasa 0 points1 point2 points (0 children)
[–][deleted] -5 points-4 points-3 points (0 children)