New submission from Raymond Hettinger:

The use of urllib for REST APIs is impaired in the absence of a "Accept: */*" 
header such as that added automatically by the requests package or by the CURL 
command-line tool.



# Example that gets an incorrect result due to the missing header
import urllib
print 
urllib.urlopen('http://graph.facebook.com/raymondh').headers['Content-Type']

# Equivalent call using CURL
$ curl -v http://graph.facebook.com/raymondh
...
* Connected to graph.facebook.com (31.13.75.1) port 80 (#0)
> GET /raymondh HTTP/1.1
> User-Agent: curl/7.30.0
> Host: graph.facebook.com
> Accept: */*
>

----------
files: accept.diff
keywords: patch
messages: 227194
nosy: rhettinger
priority: normal
severity: normal
stage: patch review
status: open
title: urllib doesn't put Accept: */* in the headers
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file36673/accept.diff

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22450>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to