python requests: url with another sub-requests

When I execute manually this URL in my webbrowser I see in my network console that three other requests will be executed. it works. call: www.my.url/publish_something get this cmd get that cmd post that... How can I do it in Python requests? Th...
more »

2017-06-22 13:06 (1) Answers

python requests loading big page solution

I have this trouble when opening a big page about 82,000 lines with Python requests lib. Before I tried to use urllib2, but here was an error "IncompleteRead" Now with requests: r = requests.get(https://www.bhphotovideo.com/c/search?atclk=Model+Y...
more »

2017-05-22 09:05 (1) Answers

Loading Image Resource into Numpy Array

I'm trying to get a JPEG image resource from the web into a NumPy array image representation similar to the array returned by scipy.misc.imread. Instead of saving the image to disk, as in the example below: import requests from scipy import misc de...
more »

2017-05-18 22:05 (2) Answers

Add string from list to url for API get request

Hi I have an API get request that retrieves numbers that I put into a list. I then want to loop over that list, adding every number in the list to a separate new get request. The code I have so far is: for evt in eventList: main_api = 'https://a...
more »

2017-05-16 13:05 (1) Answers

python requests, what i am missing?

import requests a = 'http://www.wipo.int/branddb/en/?q={"searches":[{"te":"coca%20cola","fi":"BRAND"}]}' b = requests.get(a) print(b.text) Here is a simple webpage. If I paste url in browser and open the link, I get the results I want to see. If...
more »

2017-04-19 23:04 (1) Answers

Why does browser send requests for static files?

I have seen in Firebug that my browser sends requests even for all static files. This happened when I have enabled caching for static files. I also saw the server response with 304 status code. Now, my question: Why should the browser send requests ...
more »

2017-04-15 10:04 (1) Answers

Prevent http request caching at client side

I am trying to measure the response time of a Web Server , at client side but the response times are very small. So I think that the requests are caching at the client side. I have already tried adding appendices next to url but no change. ...
more »

2017-03-19 13:03 (0) Answers

Python connect to rest api

i want to connect to a rest api with the following code: data = requests.get("http://pbx/rest/login").json() head = {'loginType' : 'Internal','nonce' : data["nonce"], 'secret' : (hashlib.sha1((LOGIN_ID+data['nonce']+PASSWORD).encode('utf-8')).hexdig...
more »

2017-02-18 13:02 (1) Answers

Google Maps API Parameters

I'm sure this is an obvious mistake, but does anyone know why this code isn't working? Am I using the python requests library incorrectly? import requests header = {'Content-Type ': 'application/json'} body = { "api_key": REDACTED, "size": "20...
more »

2017-01-06 23:01 (1) Answers

Passing Token to REST Api using Python

I know that there are a few question on SO that seem to answer this question but none of them get the job done for me. So here is my code ... import requests bearer_token = 'eyJhbGciOiJIUzI1NiIsImtpZCI6IlRFU1QifQ.eyJjbGllbnRpZCI6ImFhZDkyNjc5MmJiMj...
more »

2016-12-06 22:12 (1) Answers

Is Jython a liability in my codebase?

I've inherited a large Java/Scala codebase that uses Jython to interface with our equally large Python codebase. Things were going swimmingly until about three days ago when suddenly all of our builds started failing in the Jython stage with the mes...
more »

2016-11-19 22:11 (1) Answers

requests.exceptions.SSLError

I have fiddle.py containing 4 lines import requests url = "https://randomuser.me/api/" locations = requests.get(url,verify=False).json() print locations When I run it, I kept getting requests.exceptions.SSLError: [SSL: SSLV3_ALERT_HANDSHAK...
more »

2016-11-08 17:11 (1) Answers

restful python upload file to server

I have a server running flask and some api open for client to upload file. The client is having problem when uploading big file(>100MB). At first, I tried urllib2 using the following code at client: def uploadFile(url, params, user, token): tr...
more »

2016-10-24 15:10 (0) Answers

Python requests: URL with percent character

I have been searching all over the place for this, but I couldn't solve my issue. I am using a local API to fetch some data, in that API, the wildcard is the percent character %. The URL is like so : urlReq = 'http://myApiURL?ID=something&param...
more »

2016-10-21 09:10 (4) Answers