python-requests

Select specific values from JSON output

Select specific values from JSON output Question: I am querying a REST API and I need to select 2 fields from the adapter output below. I basically need to make variables from OUT_Detailed Description and OUT_Vendor Ticket Number: Code: headers = {‘content-type’: ‘application/json’, ‘Authentication-Token’: authToken} response = requests.post(‘http://dev.startschools.local:2031/baocdp/rest/process/:ITSM_Interface:IncidentManagement:QueryIncident/execute’, headers=headers, data=json.dumps(get_query_inc_json())) print(response.text) json_format = json.loads(response) Description …

Total answers: 2

Parse a table from wikipedia that is hidden

Parse a table from wikipedia that is hidden Question: I’am pretty new here. I want to parse a table from wikipedia from a following link: https://en.wikipedia.org/wiki/MIUI I was able to parse first table, but I can’t figure out how to get the information from the second table there, the information that contains "version history" of …

Total answers: 1

How to add images with Discord API and Python Requests

How to add images with Discord API and Python Requests Question: I want to send an image that I have stored on my computer through this code import requests import time headers = {‘authorization’: TOKEN, ‘Content-Type’: ‘application/json’} url = f"https://discord.com/api/v9/channels/{CHANNEL}/messages" data = { "content": message } files = { ‘file’: (open(‘image.png’, ‘rb’)), } r = …

Total answers: 1

POST request returning null values

POST request returning null values Question: I’m trying to make some POST requests to a website and, while I get 200 responses every time I do so, the values of said responses are all either null or 0’s. I’ve tried using all the headers visible when inspecting the website, just a combination of them, insertint …

Total answers: 1

Python requests stop redirects does not work

Python requests stop redirects does not work Question: I want to access the content of a web page, but I’m being redirected to another page even though I’ve set allow_redirects to False in my requests call. Here’s an example code snippet: import requests from bs4 import BeautifulSoup headers = {‘User-Agent’: user_agent} # assume I inserted …

Total answers: 1

Why is beautifulsoup not returning data elements?

Why is beautifulsoup not returning data elements? Question: I’ve tried many things to return the data on this page: https://www.hebban.nl/rank . For some reason it’s not returning any data point, after many tries. Can someone point me in the right direction and tell me what I’m doing wrong. I’m learning but I seem to be …

Total answers: 1

curl to python requests conversion for solr query

curl to python requests conversion for solr query Question: I have a bit of a bizzare problem. I have a solr index, which I query using curl like so: curl ‘http://localhost:8984/solr/my_index/select?indent=on&q="galvin%20life%20sciences"~0&wt=json&sort=_docid_%20desc&rows=5’ and I get (note the q string and the tilde operator which I use for proximity search): { "responseHeader":{ "status":0, "QTime":1, "params":{ "q":""galvin life …

Total answers: 1

How can I POST a JSON to an Express server with python module "requests"?

How can I POST a JSON to an Express server with python module "requests"? Question: So, I’m trying to post a JSON to a Node.JS server running Express with Python using the "requests" module. I’ve made a lot of tries, all of them failed. Closest I got was this: Server code: const fs = require(‘fs’); …

Total answers: 2

Python: How to get index from an Array of JSON?

Python: How to get index from an Array of JSON? Question: So, I was able to answer my question before on how to get the value of a JSON from an array of JSON. But now I’m trying to convert it in Python(for selenium). Here is the Array of JSON: [ { "id": 3328367679, "inbox_id": …

Total answers: 2