Most voted "python-requests" questions
88 questions
Sort by count of
-
5
votes2
answers836
viewsHow to set a header with a JWT token in a request made by the Requests library?
I’m using the library Requests Python to make HTTP requests. I was able to post a request quietly in order to obtain a JWT token. But now I need to send this token through a header, but I have no…
-
4
votes1
answer1967
viewsHow to take data from a JSON with Python
I’m taking data from a JSON. Only I’m having a problem. { "atividade_principal":[ { "text":"Atividades de televisão aberta", "code":"60.21-7-00" } ], "data_situacao":"03/11/2005", "nome":"GLOBO…
-
3
votes1
answer564
viewspreApproval data is required
Currently, I am trying to integrate a prepayment via v2 of the api for pagseguro. For some reason I keep getting pre-approval data is required. I tried chaning the headers, I was also checking the…
-
2
votes3
answers3149
viewsJSON does not return utf-8
I am using freegeoip to know my location and use it in my program, but when I make a call using: r = requests.get(location_url, headers={"content-type":"application/json;charset=UTF-8"}) The return…
-
2
votes2
answers172
viewsI would like to know how to write >>> print("Size = %4.2f cm" % Size) and what does %4.2f mean
I’m doing a college assignment and I’d like to know what the %4.2f in >>> print("Tamanho = %4.2f cm" % Tamanho) and how a value (8.47826) is represented by following this parameter after…
-
2
votes1
answer332
viewsCheck url after request
How do I make my code check which url/link is in ? My code: import requests as r from bs4 import BeautifulSoup as bs import time import os clear = lambda: os.system('cls') clientes1 = 0 clientes2 =…
-
2
votes1
answer56
viewsHow to stop running Python code for time?
How can I make a chunk of code run for x seconds and then stop? In the specific case, I’m expecting a response from a page using request, but if it takes longer than 5 seconds, I want to stop and…
-
2
votes1
answer2189
viewsPython: SOAP requests, how to request a wsdl
Hello, I have a wsdl (https://ws1.bmgconsig.com.br/webservices/SaqueComplementar?wsdl) and need to make requisitions, but do not know how to do the treatment of headers and body based on wsdl. the…
-
2
votes3
answers516
viewsHow to compare two JSON objects with the same elements in Python
I have two Apis that bring me the data in JSON. I’m just not able to make the logic to compare the two. API 1: API 2: My logic is to compare the two on the die FlightID and if it’s the same, give me…
-
2
votes2
answers397
viewsLONG delay in requests.get Python
I’m having a problem that when I perform requests.get diverse sometimes python starts to take A LONG time to get the request. I already thought it may be the API itself refusing my access, because…
-
2
votes0
answers28
viewsHow to put hangman game in a window, so you can send it to someone to play
I would like to make this hangman game work in a window, I would like to do it in a way that my daughter can play, I’m still learning, follow the code: import pygame from pygame.locals import* from…
python-requestsasked 3 years, 9 months ago Walles Larissa Tatiane 21 -
1
votes1
answer229
viewsHow to get only one Json value using request.get_data() Flask Python
I’m a Python beginner and a hint to get only one value from the following Json. { "test1":"valortest1", "test2":"valortest2", "test3":"valortest3", "test1":"valortest1" } Use to get json as follows…
-
1
votes1
answer1118
viewsTypeerror: POST data should be bytes, an iterable of bytes, or a file Object. It cannot be of type str
I’m trying to translate a code from Python 2.7 to 3.6 Code 2.7 works perfectly: from urllib2 import Request, urlopen values = """ { "exchange_code": "PLNX", "exchange_market": "BTC/USDT" } """…
-
1
votes2
answers690
viewsSubmit form in python
I’m trying to submit a form on the website https://www.loskatchorros.com.br/ucp/login.php ,but I’ve searched several ways here on stackoverflow how to submit a form, and found no way to solve this…
-
1
votes1
answer300
viewsUrllib.request or Request?
I am studying web scraping and in many guides I have seen examples where they are used urllib.request and request.get. From what I’ve tested and understood the two do the same thing. So what’s the…
-
1
votes1
answer88
viewsError printing HTML with Beautifulsoup
I have a simple code that accesses a quiz site and takes all the ul which contain the class square and prints on screen. url = "http://quizdomilhao.com.br/category/g1" question_page =…
-
1
votes1
answer2424
viewsrequests.exceptions.Sslerror: Certificate Verify failed
I’m having a big problem with Django requests. In the last few months I upgraded to version 2.0 of Django, and I’m updating all libs. I noticed that this impacted several scripts that I had, mainly…
-
1
votes0
answers310
viewshow to capture specific tokens in python requests
I need to capture specific cookies from a python code and pass them on later, the problem is, if I set cookies manually they work for a while but after a few days they expire. I can pick up a…
-
1
votes0
answers124
viewsHow do I access a POST endpoint from a Django view?
I need to provide a service that requests a Django view method using lib requests. The method is as follows:: def classify(request): print(request) if request.method == "POST": form =…
-
1
votes0
answers46
viewsFile upload with HTTP-POST
When running the script to send the file it returns me this message. Traceback (most recent call last): File "modelo.py", line 102, in <module> filepath = args.filepath AttributeError:…
-
1
votes2
answers816
viewsIn requests, how to correctly read the ISO-8859-1 encoding?
In Python3, with beautifulsoup4 and requests, I want to extract some information from a site that has encoding 'ISO-8859-1'. I tried this strategy to show correctly the text: import requests from…
python character-encoding python-requests beautifulsoupasked 5 years, 6 months ago Reinaldo Chaves 333 -
1
votes1
answer73
viewsLogin GITLAB using request
I am trying to log in to gitlab using python requests library but is showing the error (The change you requested was Rejected (422)) Note. I cannot use any external library(Selenium, bs4,…
-
1
votes2
answers179
viewsEncoding problem while extracting zip file - edited
A webhook calls my API by sending a POST request. On the request body contains the url of a ZIP file. Using the requests library, I perform a GET at the file url. I need to extract this few files…
-
1
votes1
answer1363
viewsSites with authentication - Web Scraping - Python
BR: I’m trying to automate a web data acquisition process using Python. In my case, I need to pull the information from the page https://sistema.justwebtelecom.com.br/adm.php. However, before going…
-
1
votes1
answer73
viewsJsondecodeerror Expecting value: line 1 column 1 (char 0) - content-type: text/xml
I have a project to capture Atms next to a coordinate on the Mastercard website form. I can bring the result but not in json. By Content-Type be text.XML, should not allow to bring result in json?…
-
1
votes1
answer57
viewsI need to inform the user if it contains a registered user with this same user name
Opa, then, I need to inform to those who are using the program, if you already have any user registered with this name and inform the age of the same contains in the list that must be registered…
-
1
votes0
answers35
viewsOperation I/O 'Block' loop?
Greetings friends, I come here to ask for help in relation to doubt about the operations of Request and with the operation Open. As far as I know and read, the operation file_request =…
-
1
votes1
answer47
viewsWhy does the HTTP request response not recognize special characters?
Why when I make a request using Beautifulsoup in Python, my answer does not consider Latin characters? Code: import requests from bs4 import BeautifulSoup req = requests.post(url=…
-
0
votes1
answer193
viewsPython and Django online course creation platform
I’m building a platform for creating online courses, and I’m using Python and Django. I would like to know whether there are already libraries in Django for this purpose. An example I’m using is the…
-
0
votes4
answers7060
viewsI cannot import any Python module
I want to import the module requests from Python to a program I’m doing, but it doesn’t stop giving the following error, so I run the program: ModuleNotFoundError: No module named 'requests' I have…
-
0
votes1
answer325
viewsModule requests is imported into IDLE, but not into Thonny (the IDE I use)
I installed the module requests by Terminal with sudo pip3 install requests (I am using Mac) and managed to import it through the Interactive shell without problems in IDLE. But when I try to import…
-
0
votes1
answer75
viewsInformation from an API in your web application - Flask Python
I’m a beginner in python and I’m venturing into flask because I thought learning better than Django. So excuse my ignorance of what I’m going to ask or if my code is wrong, more like I do to take…
-
0
votes1
answer89
viewsExtract data from a website and play in your Flask web application
Which module could I use in flask to get data from an API and play in my web application in the HTML part
-
0
votes1
answer240
viewsHow to correctly read a multi-level JSON?
In Python3 this code reads the Senate API to create a dataframe of one-year propositions import requests import pandas as pd headers = {"Accept" : "application/json"} proposals = [] url =…
-
0
votes0
answers110
viewsHow to save and finish python code?
I’m using a camera to capture video, and save the video. I’m trying to save and finish the code with a command in the IDLE(python) but I’m not getting it. Actualement to finish and save the program…
-
0
votes1
answer370
viewsGet method error in Python Requests library
I’m trying to learn how to use the library Requests in python, but there is an error that I do not know how to solve, in several tutorials creates the variable r =…
-
0
votes1
answer937
viewsCatch element using python json
I’m using the following code to try to get what’s written inside definition, located in list import requests import json word = "salut" page =…
-
0
votes1
answer148
viewshow to handle a json that contains several results using python
Hello, I’m making a python script that takes the name of a movie and returns some data to the user(title, year etc). I am using the omdbapi, but my doubt is not about it but about how to handle the…
-
0
votes0
answers84
viewsProblems using the requests library
I am having trouble using python2’s requests library. I have already performed the installation and when I run pip install requests I see she’s already settled in. Someone could help? Python 2.7.14…
-
0
votes0
answers85
viewsPython: Sslerror, bad Handshake, Unexpected EOF em get request
I am trying to get a request on a specific site, but am having problems with the error listed below. My code: import requests url =…
-
0
votes1
answer105
viewsAPI WEB error with flask
I started my WEB API study trying to create a Pokedex API, When I tried to create the function of searching for Pokemon by number the following error appeared: "json.decoder.Jsondecodeerror:…
-
0
votes1
answer865
viewsRequests, Beautifulsoup <Tables>
I have a website that wants to extract specific data from a table I want to extract all information that has "PROLONG". My difficulty is that all tables have the same name in the "class"…
-
0
votes1
answer470
viewsIterating web pages using Requests and Python
I am beginner in web scraping. How to learn making a database from data on selling semi-new cars on some websites. One of the sites is this url =…
-
0
votes1
answer38
viewsHow to turn all Dataset into monetary values, or at least round them
This is a part of a dataset column: 0 1.347688e+05 1 1.563599e+05 2 1.788441e+05 3 1.983543e+05 I tried that: from babel.numbers import format_decimal format_decimal(df.Receita_liquida,…
-
0
votes1
answer119
viewsError every time I make a Flask Requests
When I make requests from an Api to show the number of players in my template where "For in range (200)" returns the data and not the error. <table class="cor"> <tr class="fundo">…
-
0
votes0
answers25
viewsHow to automate the execution of Python scripts in Google Colab? Sheduler
I developed a python script to automate data requests and integration with Bigquery. I wonder if there’s any way to run this script automatically in a routine from Monday to Friday, always at…
python python-3.x python-requests ipython-notebook schedulerasked 3 years, 5 months ago Fhelyp Guimarães 1 -
0
votes1
answer724
viewsSite with hidden HTML
I need to extract the sales data of semi-new cars on some websites. One of the sites is the Locamerica company. However, on her website does not appear in the HTML page the content I need to…
-
0
votes0
answers15
viewsHow can I using the installed library add a list of profiles? at this point I have to add one by one
I know it is possible using profile_list['profile1, profile2,.. '] but when I try to do this in my code it does not work. What I do? from instaloader import Instaloader, Profile import instaloader…
-
0
votes0
answers60
viewsResult of paged loop instead of unified
I’m having trouble getting a result formatted in JSON paged. My code instead of returning the result of the joined is bringing the result per page! import requests def __init__(self, usuario,…
-
0
votes0
answers98
viewsHow to add values of a request:
Example: request = requests.get('https://api.amountofsomething.com') quantidade = requisição.json()['amount'] This request returns the quantity, for example: {[{25}{120}{158}{0}{2}{10}]} I need to…