Tips for hitting the ATND API in Python

Be careful when hitting the ATND API.

http://d.hatena.ne.jp/fuyumi3/20120322/1332387731

As I wrote here, for example, if you want to specify multiple event ids, you can write parameters separated by commas, such as "event_id = 12345,12346,12456".

So, of course, when you actually stream this, urllib.urlencode is done, but this API specification is that, escape the comma If event_id = 12345% 2C12346% 2C12456, it will not be recognized correctly. You have to send it with a comma as it is. / (^ O ^) \ Nante Kottai

As a workaround, urllib has a property called always_safe, which contains strings to exclude from escaping.

python


import urllib
print urllib.always_safe
# => ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-

So if you add a comma to this guy

python


urllib.always_safe += ','
print urllib.always_safe
# => ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_.-,

Recommended Posts

Tips for hitting the ATND API in Python
Try hitting the YouTube API in Python
Getting the arXiv API in Python
Hit the Sesami API in Python
Hit the web API in Python
Access the Twitter API in Python
Try using the Wunderlist API in Python
Try using the Kraken API in Python
Tips for dealing with binaries in Python
Tweet using the Twitter API in Python
MongoDB for the first time in Python
Tips for making small tools in python
Try hitting the Spotify API in Django.
Play by hitting the Riot Games API in Python First half
Created a Python wrapper for the Qiita API
Try using the BitFlyer Ligntning API in Python
Evernote API in Python
C API in Python 3
Hit the Firebase Dynamic Links API in Python
Try using the DropBox Core API in Python
Initial settings when using the foursquare API in python
Using the National Diet Library Search API in Python
I tried hitting the API with echonest's python client
Hit Mastodon's API in Python
Download the file in Python
Find the difference in Python
Search for strings in Python
Techniques for sorting in Python
Blender Python API in Houdini (Python 3)
Call the API with python3.
[Python + Selenium] Tips for scraping
Google Drive Api Tips (Python)
~ Tips for beginners to Python ③ ~
About "for _ in range ():" in python
Automate background removal for the latest portraits in a directory with Python and API
Try hitting the Twitter API quickly and easily with Python
A note about hitting the Facebook API with the Python SDK
Get your heart rate from the fitbit API in Python!
Check the operation of Python for .NET in each environment
Tips for coding short and easy to read in Python
[Understand in the shortest time] Python basics for data analysis
Tips for Python beginners to use the Scikit-image example for themselves
[Tips] Problems and solutions in the development of python + kivy
Google search for the last line of the file in Python
Parse the Researchmap API in Python and automatically create a Word file for the achievement list
Check for memory leaks in Python
Check for external commands in python
Python in the browser: Brython's recommendation
Save the binary file in Python
LaTeX, Python tips in master's thesis
In the python command python points to python3.8
Implement the Singleton pattern in Python
Hit the Etherpad-lite API with Python
Create Gmail in Python without API
[TouchDesigner] Tips for for statements using python
Tips for calling Python from C
Use the Flickr API from Python
See python for the first time
I wrote the queue in Python
Calculate the previous month in Python
Examine the object's class in python