Skip to content
Advertisement

Tag: urllib

Parameters are ignored in python web request for JSON data

I try to read JSON-formatted data from the following public URL: http://ws-old.parlament.ch/factions?format=json. Unfortunately, I was not able to convert the response to JSON as I always get the HTML-formatted content back from my request. Somehow the request seems to completely ignore the parameters for JSON formatting passed with the URL: Does somebody know how I am able to get the

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: https://learn.microsoft.com/en-us/microsoft-365/security/defender-endpoint/run-advanced-query-sample-python?view=o365-worldwide#get-token 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 6 months 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 “eu.mouser.com” and “uk.farnell.com” 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 “https://images.unsplash.com/profile” 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.

Python: urllib.parse.quote_plus and edit string

I need to add a wild card to a urllib.parse.quote_plus command but I am unclear how to. When I execute the following on my flask server, I get the following error: How might I add a wildcard in here to accept an object? Answer i think you should do the replacing first or

Advertisement