Questions tagged [http.client]

97 questions
0
votes
1 answer

How to get from POST request .getresponse()(json) specific thing("access_token": value)? (using import http.client)

I get json as response as: {"access_token":"QVQ6YmNlZjI0fdsfsFSZiLWE0OTgtZGUwMTJhMDdjMjYz","token_type":"Bearer","expires_in":7776000} How do I write to a variable just one value from response? Need "access_token" key value (=…
akfas
  • 41
  • 4
0
votes
1 answer

What should I use with proxies? Sockets, http.client, pycurl, or anything else?

Okay so basically, I'm writing a piece of code that heavily depends on speed, headers = { 'Authorization': 'Bearer '+jtw, } conn = http.client.HTTPSConnection("api.minecraftservices.com") conn.request("PUT",…
0
votes
0 answers

How would I implement my proxy into a request with http.client?

headers = { 'Authorization': 'Bearer '+jtw, } conn = http.client.HTTPSConnection("api.minecraftservices.com") conn.request("PUT", "/minecraft/profile/name/"+user, headers=headers) response = conn.getresponse() status_code = response.status resp…
0
votes
1 answer

Using ijon package to read big json file (http.client.IncompleteRead error)

I'm trying to read a big json file (>1,5Gb), using ijson package and deal with the results. response = requests.get("https://api.scryfall.com/bulk-data/all-cards") with urlopen(response.json()["download_uri"]) as all_cards: for…
Benjamin
  • 65
  • 1
  • 8
0
votes
1 answer

Postman POST request works but doesnt when exported to cURL / request / http.request

I am completly lost because I got no idea anymore what I am doing wrong. I want to make a simple POST request to a certain address. I visited the website using firefox, opened it's terminal, copied the POST request as cURL and executed in the…
Tayfe
  • 37
  • 5
0
votes
0 answers

http.client not working for localhost in Python

My code : import http.client h1 = http.client.HTTPConnection('127.0.0.1') h1.request('GET', '/') I tried with localhost instead of the IP too and it doesn't work also. I am sure my apache is running, as i tested from the browser. Traceback (most…
user2370139
  • 1,297
  • 1
  • 11
  • 13
0
votes
0 answers

Twitch.TV downloader: Memory leak and http.Client dial lookup : too many open files

I am writing streamlink-alike CLI tool, but capable of downloading multiple twitch.tv live streams simultaneously using goroutines. After a few hours memory usage is 37% (2 GB RAM) and unix file descriptors hits limit. Increasing 'ulimit -n' is…
wmw
  • 1
0
votes
2 answers

decoding a PUT request in Netty

I have created an HTTPServer in Netty with the following handler: public class HttpRouterServerHandler extends SimpleChannelInboundHandler { public void channelRead0(ChannelHandlerContext ctx, HttpRequest req) { if…
Hervé Girod
  • 465
  • 3
  • 12
0
votes
1 answer

Better alternative to http.client

I have been trying to make my discord bot take a certain number of subdomains from a website it scraped and filter them through with http.client by making requests to retrieve the ones that respond with 200 OK, this worked for google.com, but many…
CrypticDev
  • 35
  • 6
0
votes
1 answer

How to get an HTTP response with specific port using http.client?

I tried to get a page contents of the following URL http://username:5000/check/e9549df676ecca6344ad8ba068d05a6d So I tried to write the following script but with no success import http.client conn =…
Rge dsfs
  • 13
  • 2
0
votes
1 answer

http.Client in goroutines

I have a text file with this content: 192.168.1.2$nick 192.168.1.3$peter 192.168.1.4$mike 192.168.1.5$joe A web server is running on each IP in the list. I need to check if the servers are currently available and output a message if not…
Evgeny
  • 45
  • 6
0
votes
0 answers

Troubleshooting Python api request error message "Remote end closed connection without response"

Am trying to connect an API in my organization, but am always receiving the below error message. But being able to connect other similar API/reports using the same below script. Am able to get results when running the API URL in a web browser. So…
Guruprakash
  • 13
  • 1
  • 5
0
votes
1 answer

AssertRaises fails even exception is raised when using "http.client" Python

I'm creating an API class for my project that uses the library http.Client. The issue is with unittesting, When I am trying to raise an error, and test it with assertRaises, the assertRaises fails even with correct Exception being raised. I have a…
0
votes
2 answers

TypeError: can't concat str to bytes in HTTPSConnection

I am trying to make an authorisation request and am coming up with the TypeError: can't concat str to bytes. I have searched the web and have found similar issues but none of them help solve my issue. I am currently working in Jupyter (if that…
Dean
  • 2,326
  • 3
  • 13
  • 32
0
votes
1 answer

add dynamic value to params

I'm creating small project using rapid API to get daily report for COVID 19 . import http.client ,time from datetime import datetime conn = http.client.HTTPSConnection("covid-19-data.p.rapidapi.com") headers = { 'x-rapidapi-host':…