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
2 answers

Stream pricing from oanda V20 rest api using python requests

I'm trying to stream the price of an instrument from Oandas' V20 rest api but with not much success. I am using python requests as that worked for regular get requests. Here is where i have got to: import requests url =…
4
votes
2 answers

python - request url as mobile

I'm trying to send GET request to some urls with User-Agent as mobile to get the the redirected url (for example - http://m.google.com instead of http://google.com). I've tried requests library and urllib2 too - it seems that the User-Agent isn't…
RonZ
  • 743
  • 1
  • 11
  • 31
4
votes
1 answer

How to mock requests methods called dynamically using getattr

I have class which called requests method using getattr like this: import requests class CustomRequests(object): def __init__(self): pass def _do_requests(self, method='GET', url='', expected_status=200): make_request =…
Sunil Kapil
  • 1,020
  • 13
  • 12
4
votes
1 answer

PyInstaller Hidden Imports

I have a fully working Python program that uses the following imports: import json import requests from natsort import natsorted However, when I try to compile it to an executable using PyInstaller, I get the following errors: Note: May not be…
Andrew B
  • 43
  • 1
  • 2
  • 4
4
votes
1 answer

Python requests send multiple cookies

How would you go about sending multiple cookies with python requests the documentation only gives url = 'http://httpbin.org/cookies' cookies = dict(cookies_are='working') r = requests.get(url, cookies=cookies) r.text Here is what i have tried…
Hack_Hut
  • 174
  • 3
  • 14
4
votes
1 answer

Dictionary type params in query string

I'm trying to feed the following URL structure into requests: https://inventory.data.gov/api/action/datastore_search?resource_id=8ea44bc4-22ba-4386-b84c-1494ab28964b&filters={"City":"Las Vegas","State":"NV"} I wanted to break up the URL into…
Casey
  • 2,611
  • 6
  • 34
  • 60
4
votes
1 answer

Python post request for USPTO site scraping

I’m trying to scrape data from http://portal.uspto.gov/EmployeeSearch/ web site. I open the site in browser, click on the Search button inside the Search by Organisation part of the site and look for the request being sent to server. When I post the…
narog
  • 65
  • 1
  • 11
4
votes
1 answer

How to scrape a website that requires login with Python

First of all, I know there are a bunch of similar questions but unfortunately none of them work for me. I am a relative noob in python and simple explanations and answers would be greatly appreciated. I need to log into a site programmatically using…
4
votes
1 answer

Logging in using Python's Requests

I am attempting to log in to a website using Requests and seem to be hitting a wall. Any advice would be appreciated. I'm attempting to log in to economist.com (no reason, just something I have a username and password for), whose login page is at…
argent656
  • 43
  • 5
4
votes
3 answers

Perform Download via download button in Python

I am somehow new in the region of getting data from a website. I have, e.g. a website http://www.ariva.de/adidas-aktie/historische_kurse and there is a donwload button hidden as shown in the picture below in red: The main question is how can I…
MCM
  • 1,479
  • 2
  • 17
  • 22
4
votes
2 answers

Python requests Response 504

I'm learning Python, and I'm trying to request access to a website using the command requests. I'm doing the following: import requests requests.get("http://www.charitystars.com") However I get , which should be an error because the…
tony
  • 83
  • 1
  • 1
  • 7
4
votes
0 answers

SSL Bad Handshake - AWS - Requests

I have a django app on AWS pushed with Elastic Beanstalk that is returning some SSL errors when a make a requests.POST The error I'm getting is SSLError: ("bad handshake: SysCallError(-1, 'Unexpected EOF')",) File…
shartshooter
  • 1,761
  • 5
  • 19
  • 40
4
votes
1 answer

Python Multithreading a for loop with limited Threads

i am just learning Python and dont have much expierence with Multithreading. I am trying to send some json via the Requests session.post Method. This is called in the function at the bottem of the many for loops i need to run through the…
Le olde Wire
  • 79
  • 1
  • 8
4
votes
0 answers

Add a proxy header using python requests

Specs: Python 2.7.9, Requests 2.12.4, Windows OS s = requests.Session() proxy = {'http':'http://ip:port', 'https':'http://ip:port'} r_url =…
user4642224
  • 157
  • 2
  • 6
4
votes
1 answer

Can I get a virus by visiting an unknown website using python's requests package?

I'm visiting an unknown and possibly malicious website. Lots of them. Python's requests do not run javascript. Can I get infected? Should I consider using a virtual machine?
userqwerty1
  • 887
  • 2
  • 9
  • 23