You need to pass your parameters into urlencode()
as either a mapping (dict), or a sequence of 2-tuples, like:
>>> import urllib >>> f = { 'eventName' : 'myEvent', 'eventDescription' : 'cool event'} >>> urllib.urlencode(f) 'eventName=myEvent&eventDescription=cool+event'
Python 3 or above
Use:
>>> urllib.parse.urlencode(f) eventName=myEvent&eventDescription=cool+event
Note that this does not do url encoding in the commonly used sense (look at the output). For that use urllib.parse.quote_plus
.
Related Posts:
- AttributeError: ‘module’ object has no attribute ‘urlopen’
- How to download a file over HTTP?
- AttributeError: module ‘urllib3’ has no attribute ‘urlopen’ in python
- How to download a file over HTTP?
- installing urllib in Python3.6
- How to send POST request?
- urllib2.HTTPError: HTTP Error 403: Forbidden
- UnicodeEncodeError: ‘charmap’ codec can’t encode characters
- urllib and “SSL: CERTIFICATE_VERIFY_FAILED” Error
- Python 3.5.1 urllib has no attribute request
- Python: urllib.error.HTTPError: HTTP Error 404: Not Found
- can we use XPath with BeautifulSoup?
- Download Returned Zip file from URL
- Making a POST call instead of GET using urllib2
- ‘module’ has no attribute ‘urlencode’
- What does ** (double star/asterisk) and * (star/asterisk) do for parameters?
- How to reset index in a pandas dataframe? [duplicate]
- Python: Find in list
- How to update/upgrade a package using pip?
- How do I update\upgrade pip itself from inside my virtual environment?
- IndexError: too many indices for array
- pandas read_json: “If using all scalar values, you must pass an index”
- Web scraping redoc web api
- Why am I getting “IndentationError: expected an indented block”? [duplicate]
- Reverse a string in Python
- How to uninstall Anaconda completely from macOS
- Python: Start and stop timer [duplicate]
- I keep getting this error for my simple python program: “TypeError: ‘float’ object cannot be interpreted as an integer”
- Numpy std calculation: TypeError: cannot perform reduce with flexible type
- Regex: AttributeError: ‘NoneType’ object has no attribute ‘groups’
- Internal Redirect in Flask
- ValueError: shape mismatch: objects cannot be broadcast to a single shape
- ImportError: No module named ‘Tkinter’
- Python `if x is not None` or `if not x is None`?
- syntax error when using command line in python
- ImportError: numpy.core.multiarray failed to import
- How do I upgrade to Python 3.6 with conda?
- Can’t fix “zipimport.ZipImportError: can’t decompress data; zlib not available” when I type in “python3.6 get-pip.py”
- Plot logarithmic axes with matplotlib in python
- Arrays used as indices must be of integer (or boolean) type
- python pip – install from local dir
- “ImportError: no module named ‘requests'” after installing with pip
- Append integer to beginning of list in Python
- Most efficient way to map function over numpy array
- List comprehension on a nested list?
- Get total of Pandas column
- How do you read from stdin?
- Union of two lists in Python
- Type error: cannot convert the series to
- Reading a binary file with python
- Python can’t find my module
- How to determine a Python variable’s type?
- How to deep copy a list?
- How to plot time series in python
- Pandas – DataFrame object is not callable
- Start with pyglet or pygame?
- Django 2.1.3 Error: __init__() takes 1 positional argument but 2 were given
- Python error load JSON code of google API
- How to convert IPython notebooks to PDF and HTML?
- ‘Jupyter’ is not recognized as an internal or external command
- How to print spaces in Python?
- Convert categorical data in pandas dataframe
- Visual C++ for python failed with exit status 2 when installing divisi2
- pandas create new column based on values from other columns / apply a function of multiple columns, row-wise
- Parsing HTML using Python
- How can I install the latest Anaconda with wget
- sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 74 supplied
- Truncate to three decimals in Python
- Scatter plot colorbar – Matplotlib
- “SyntaxError: non-keyword arg after keyword arg” Error in Python when using requests.post()
- Flask Error: “Method Not Allowed The method is not allowed for the requested URL”
- Pandas error “Can only use .str accessor with string values”
- matplotlib: how to draw a rectangle on image
- How to install PyGame on Python 3.4?
- ImportError: No module named ‘cv2’ Python3
- bbox_to_anchor and loc in matplotlib
- matplotlib: RuntimeError: Python is not installed as a framework
- Python: Can a function return an array and a variable?
- Python 101: Can’t open file: No such file or directory
- super() fails with error: TypeError “argument 1 must be type, not classobj” when parent does not inherit from object
- Appending values to dictionary in Python
- how to read json object in python
- find time difference in seconds as an integer with python
- Pandas: sum up multiple columns into one column without last column
- How to prettyprint a JSON file?
- How to load all modules in a folder?
- Usage of sys.stdout.flush() method
- set object is not JSON serializable
- How to convert an integer to a string in any base?
- Count Vowels in String Python
- install csv package in pycharm
- How to print the full NumPy array, without truncation?
- dump() missing 1 required positional argument: ‘fp’ in python json
- TypeError: module.__init__() takes at most 2 arguments (3 given)
- coercing to Unicode: need string or buffer, NoneType found when rendering in django admin
- Python cant convert ‘list’ object to str error [closed]
- Failed building wheel for Twisted in Windows 10 python 3
- Test Average and Grade – Python
- Cannot remove entries from nonexistent file
- WordPress + python integration