Questions tagged [python-requests]

USE ONLY FOR THE PYTHON REQUESTS LIBRARY. Requests is a full-featured Python HTTP library with an easy-to-use, logical API.

Official web site

Requests is an HTTP library written in Python under the Apache2 license.

It's meant to simplify HTTP 1.1 related tasks with several functionality out of the box. For example, there’s no need to manually add query strings to your URLs or to form-encode your POST data. Keep-alive and HTTP connection pooling are 100% automatic.

Features:

  • International Domains and URLs
  • Keep-Alive & Connection Pooling
  • Sessions with Cookie Persistence
  • Browser-style SSL Verification
  • Automatic Content Decoding
  • Basic/Digest Authentication
  • Elegant Key/Value Cookies
  • Automatic Decompression
  • Unicode Response Bodies
  • Multipart File Uploads
  • Streaming Downloads
  • Connection Timeouts
  • .netrc support
  • Chunked Requests
  • Python 2.6—3.8
  • Thread-safe.
21751 questions
4
votes
0 answers

HTTPS request using DES-CBC-SHA and latest version of Python?

I'm trying to set up https connection from Python on Windows using Requests to Cisco ASA firewall which does not have AES/3DES license installed. The goal is to download pcap capture file from URL pattern https://10.0.0.1/capture/TEST_CAPTURE/pcap…
Andrey Grachev
  • 1,259
  • 1
  • 14
  • 22
4
votes
1 answer

Log in to ASP website using Python's Requests module

Im trying to webscrape some information from my school page, but im having hard time to get past login. I know there are similar threeds, i have spend whole day reading, but cannot make it work. This is program im using (User name and password were…
4
votes
2 answers

Python 3 parse PDF from web

I was trying to get a PDF from a webpage, parse it and print the result to the screen using PyPDF2. I got it working without issues with the following code: with open("foo.pdf", "wb") as f: f.write(requests.get(buildurl(jornal, date,…
Bernardo Meurer
  • 2,295
  • 5
  • 31
  • 52
4
votes
1 answer

Why is my Flask request object always empty?

I'm creating a stupid endpoint which just logs the posted data. @app.route("/add_foo", methods=['POST']) def add_foo(): logger.debug(request.data) print(request.args.get('foo')) return "Success" I then attempt to post data to this…
erip
  • 16,374
  • 11
  • 66
  • 121
4
votes
4 answers

How can I use POST from requests module to login to Github?

I have tried logging into GitHub using the following code: url = 'https://github.com/login' headers = {'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36', …
SanJeet Singh
  • 1,291
  • 2
  • 15
  • 28
4
votes
0 answers

How to use python requests with a server that has two IP addresses

I have a Ubuntu server that has multiple IP addresses. As an example, how do I set the correct IP address for outbound requests in a library like python requests?
vgoklani
  • 10,685
  • 16
  • 63
  • 101
4
votes
1 answer

Add single certificate to requests

I am trying to connect to a corporate intranet HTTPS server, which uses an in-house CA, from within Python/requests running on a Linux machine. I have a .pem file that contains our certificate (4096 bit RSA, CSSM_KEYUSE_VERIFY, CA = true). I put…
hans_meine
  • 1,881
  • 1
  • 17
  • 29
4
votes
3 answers

How to wait for a POST request (requests.post) completion in Python?

I'm using the requests library in Python to do a POST call. My POST call takes about 5 minutes to be completed. It will create a file in a S3 bucket. After that, I want to download this file. However, I need to create an extra logic to wait for my…
GreenTeaTech
  • 423
  • 4
  • 7
  • 16
4
votes
1 answer

Python 3.51 Requests causes Proxy Error

I'm trying to consume the Informatica Cloud REST API using Python (3.51) Requests (requests package version is 2.10.0): import requests username='myuser' password='mypassword' genheaders = { 'Content-Type': 'application/json', } data =…
mroshaw
  • 337
  • 1
  • 4
  • 12
4
votes
1 answer

Downloading image with PIL and requests

I am trying to download an original image (png format) by url, convert it on the fly (without saving to disc) and save as jpg. The code is following: import os import io import requests from PIL import Image ... r = requests.get(img_url,…
Vasily
  • 2,192
  • 4
  • 22
  • 33
4
votes
2 answers

How do I reach cookie information in python requests?

I am trying to write a small script that will allow me to see information related to the cookies set by my website. I want to know if it has secure or httpOnly flags set on them. But so far I wasn't able to do it, I only figured out how to get…
Rodrigo Sasaki
  • 7,048
  • 4
  • 34
  • 49
4
votes
1 answer

Need help figuring out how to send POST login info in python

So I'm currently working on a downloader, and do to so I need to fetch .m3u8 links from webpages that are entered. I've made the program and it works fine, however for premium exclusive videos it can't access the link, because the link doesn't show…
Hendo16
  • 87
  • 1
  • 5
4
votes
1 answer

Wikidata API wbsearchentities: why are results not the same in Python than in Wikidata?

I'm using wbsearchentities (wikidata api) in a python request and I'm wondering why returned results are not the same that those seen on Wikidata. For example, the following command in Python: url =…
Patrick
  • 2,577
  • 6
  • 30
  • 53
4
votes
1 answer

Associating aiohttp requests with their responses

Very simply, I would simply like to associate responses from aiohttp asynchronous HTTP requests with an identifier, such as a dictonary key, so that I know which response corresponds to which request. For example, the function below calls URIs…
Bede Constantinides
  • 2,424
  • 3
  • 25
  • 28
4
votes
2 answers

Converting PHP curl_setopt() to Python Requests and to CLI curl

I am trying to convert the following PHP curl_setopt() to the equivalent within Python Requests as well as for CLI curl. For Python, if not possible in Requests, I will resort using pycurl. curl_setopt($process, CURLOPT_RETURNTRANSFER,…
jeff00seattle
  • 1,291
  • 5
  • 17
  • 31
1 2 3
99
100