Skip to content

Tag: urllib

Python – Converting urllib to requests

I’m writing code to access the MS365 API and the Python code example uses urllib. I want to instead use requests but I’m not sure how urllib translates into requests as my attempts of doing so have failed. The code example can be found here: Answer Modifying @BeRT2me’s answer has made this work.

How to download a file on FTP by using Python [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 19 days ago. Improve this question

request.urlopen(url) not return website response or timeout

I want to take some website’s sources for a project. When i try to get response, program just stuck and wait for response. No matter how long i wait no timeout or response. Here is my code: When i try to other websites, urlopen return their response. But when i try to get “” and “” not return their response.

403 Forbidden error when getting cat images

I just finished programming a dog photo program, and after a few issues it works fine. I decided to make a modified version that uses a different api to give cat images instead. It took a second to figure out but after changing the format, I get this error: urllib.error.HTTPError: HTTP Error 403: Forbidden This error is consistent and happens

How to filter some urls from python list?

I wrote this code for extract images urls from a web page as I given. And it shows all images urls. But I need to filter “” urls and print them. I tried; And didn’t worked! Answer You need to iterate through the images and then look if each of the image within images contains the required string or not.

Ubuntu 18.04 python 2.7 urllib request not getting data

I have this python script which works with no problem on ubuntu 16.04 But it wont get data in ubuntu 18.04, any idea what the problem could be? No errors. Output: Full code is here : Answer Since you’re using the Requests library, you should use it on each API. Requests provides a method to extract JSON, so you

Python3: JSON POST Request WITHOUT requests library

I want to send JSON encoded data to a server using only native Python libraries. I love requests but I simply can’t use it because I can’t use it on the machine which runs the script. I need to do it without. My server is a local WAMP server. I always get an urllib.error.HTTPError: HTTP […]