[Tutor] Using 'requests' + 'with statement' in Python 3.4.1

Juan Christian juan0christian at gmail.com
Fri Sep 19 20:56:22 CEST 2014


On Fri, Sep 19, 2014 at 3:53 PM, Peter Otten <__peter__ at web.de> wrote:
>
> If I understand you correctly you can test for the presence of a value.
> Example:
>
> api = response.json()['response']['players'][steamID64]
> status["steamrep_scammer"] = "steamrep_scammer" in api


Thanks, this way I can only have problems calling the 'requests.get()',
right (In the case the URL doesn't exists)? This would be only one
try-expect in each function, this way is good for me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20140919/29cdd3a7/attachment.html>


More information about the Tutor mailing list