Python hit an error at line 3…
File “”, line 3
conn = http.client.HTTPSConnection(“developers.onemap.sg”)
^
SyntaxError: invalid character in identifier
For a start, I will like to find out what operating system you are using. If you are using MacOS, the double quotes might be different and caused a syntax error.
I have finally managed to run the codes by retyping all " and replacing " with ’ for username and password. Not sure what happens to the characters when i copy and paste onto my jupyter workbook.
hmmm, connection error.
ConnectionError: HTTPSConnectionPool(host=‘developers.onemap.sg’, port=443): Max retries exceeded with url: /privateapi/auth/post/getToken (Caused by NewConnectionError(’<urllib3.connection.VerifiedHTTPSConnection object at 0x0000000005F8FDD8>: Failed to establish a new connection: [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond’,))
s = requests.Session()
resp = s.send(no_file_multipart_req)
Basically, Python requests doesn’t have explicit support for multiforms, you’ll have to use this method instead.
Also, there’s no need to, and we shouldn’t be setting the boundaries ourselves.