What do you want to save?
Add Code snippet
New code examples
-
Python 2021-09-30 22:22:05
python requests.get timeout
# Here is how to set a time out for requests.get in python # its simple! import requests link = 'https://google.com' request_from_link = requests.get(link, timeout=10) # this causes the code to call a timeout if the connection or delays in # between t... Add solution -
Python 2021-09-30 03:43:05
python send image in post request with json data
import base64 import json import requests api = 'http://localhost:8080/test' image_file = 'sample_image.png' with open(image_file, "rb") as f: im_bytes = f.read() im_b64 = base64.b64encode(im_bytes).decode(&quo... Add solution -
Python 2021-09-29 02:54:02
how to get text from a website python
import requests from bs4 import BeautifulSoup #pip install bs4 url = 'https://www.troyhunt.com/the-773-million-record-collection-1-data-reach/' res = requests.get(url) html_page = res.content soup = BeautifulSoup(html_page, 'html.parser') text = soup.fi... Add solution -
TypeScript 2021-09-27 22:34:02
python requests use many proxy
import random import requests proxies_list = ["0.0.0.0","1.1.1.1","2.2.2.2","pr.kirekhar.com/pr"] r = requests.get('http://10.1.7.70:8000', proxies={ 'http': random.choice(proxies_list) }) Add solution -
Python 2021-09-27 13:27:02
image from wikipedia module in python
import wikipedia import requests import json WIKI_REQUEST = 'http://en.wikipedia.org/w/api.php?action=query&prop=pageimages&format=json&piprop=original&titles=' def get_wiki_image(search_term): try: result = wikipedia.search(... Add solution -
Python 2021-09-25 22:58:02
python get response headers
import requests url = "https://www.google.com" response = requests.head(url) print(response.headers) # prints the entire header as a dictionary print(response.headers["Content-Length"]) # prints a specific section of the dictionary Add solution
Best helpers
Sylvia Bryan
+5
Mikeonly
+5
Martisj
+5
Eric Vavylon
+5
Y2k
+5
Paisleykaat
+5
Tammam
+5
Kadeem
+5
T.A. N
+5
KingW3
+5
Harindra
+5
NFL
+5
Rajendra
+5
Fdsuhygfuig
+5