Skip to content

Instantly share code, notes, and snippets.

@curious-eyes
Created June 30, 2013 00:20
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curious-eyes/5893237 to your computer and use it in GitHub Desktop.
Save curious-eyes/5893237 to your computer and use it in GitHub Desktop.
urllib2 sample sending OPTIONS method.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
opener = urllib2.build_opener(urllib2.HTTPHandler)
request = urllib2.Request('http://example.com', data='your_put_data')
request.add_header('Content-Type', 'your/contenttype')
request.get_method = lambda: 'OPTIONS'
url = opener.open(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment