I am kind of very new to python. I tried to loop through an URL request via python and I want to change one variable each time it loops. My code looks something like this: I want to have the url change at every loop to like url_part1+code+url_part3 and then url_part1+NEXTcode+url_part3. Sadly my request badly formats the string from the
Tag: python-requests
create request with python requests (translation from another language to python)
This piece of code is from the api documentation. I can’t figure out how to perform this action in python. Please help me to complete this query using python. Answer A simple translation:
requests.auth.AuthBase TypeError on call
From the docs at https://docs.python-requests.org/en/master/user/authentication/ I gathered that the __call__ function in my own Auth Class should have the r argument, However when i go to call this class in requests.get(auth=MyClass), I get the error TypeError: __call__() missing 1 required positional argument: ‘r’ The code for my class can be found here https://pastebin.com/YDZ2DeaT I’ve tried using the example code, which
python POST request giving ‘the payload is invalid’ message
Here is my code Why is it giving this error even though my payload is correct. Before this, i was not including ‘xsrf-token’ and it was giving ‘Page Expired’ as the response. The response I am receiving. Answer you need to decode xsrf before pass it in headers
How to change names of scraped images with Python?
So I need to download the images of every coin on the list on CoinGecko, so I wrote the following code: However, I need to save the images with their names being the same as the ticker of the coin of that list from CoinGecko (rename bitcoin.png?1547033579 to BTC.png, ethereum.png?1595348880 to ETH.png, and so forth). There are over 7000 images
can’t get the correct data by calling an API using python request library while it works with postman
After opening the enter link description here I can see an API gets called which returns some data in JSON format. Attached you may see as well. I am trying to call this API using my python script as follows. but unfortunately, it returns me this message instead of the real data. on the other hand, when I sent the
Concurrency for requests
I have a python script and I’m sending post requests to same url with different data(different ids). I have to send requests for each id and check them continuously to see if there is a change. I’m handling it with iterating an “ids” list with for loop and sending request for each id and then iterating the list again and
Python requests not redirecting
I’m trying to scrape word definitions, but can’t get python to redirect to the correct page. For example, I’m trying to get the definition for the word ‘agenesia’. When you load that page in a browser with https://www.lexico.com/definition/agenesia, the page which loads is https://www.lexico.com/definition/agenesis, however in Python the page doesn’t redirect and gives a 200 status code This is how
How to parse a list of dictionaries in Python 3
I’m using python(requests) to query an API. The JSON response is list of dictionaries, like below: I’d like to extract 1 field (Identifier) as a list for further analysis (count, min, max, etc.) but I’m having a hard time figuring out how to do this. Answer Python has a syntax feature called “list comprehensions”, and you can do something like:
How to check for what JSON data exists in a Python HTTP Request?
I’m working on a script with Python that will generate a joke using an API I found online. (https://sv443.net/jokeapi/v2/). However, some of the setup/question parts of the joke use JSON Data, which varies between being ‘setup’ and ‘joke’. I’m looking to see if I can write a script that will check which one the response is pulling. I have my