Skip to content

Instantly share code, notes, and snippets.

@amalakar
Created May 30, 2012 18:56
Show Gist options
  • Save amalakar/2838282 to your computer and use it in GitHub Desktop.
Save amalakar/2838282 to your computer and use it in GitHub Desktop.
Test Case for requests Issue #598 Pass json objects as url parameters
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
import unittest
# Path hack.
sys.path.insert(0, os.path.abspath('..'))
import requests
class TestJsonAsUrlParam(unittest.TestCase):
def test_json_as_url_param(self):
print requests.__version__
fullurl = 'https://www.googleapis.com/freebase/v1/mqlread?query=%5B%7B%22percentage_alcohol%3E%22%3A+0%2C+%22country%22%3A+null%2C+%22type%22%3A+%22%2Ffood%2Fwine%22%2C+%22name%22%3A+null%2C+%22percentage_alcohol%22%3A+null%7D%5D'
r = requests.get(fullurl)
self.assertEqual(r.status_code, 200)
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment