Skip to content
Advertisement

Tag: python-requests

Download PDF from PeerJ

I am trying to use Python requests to download a PDF from PeerJ. For example, https://peerj.com/articles/1.pdf. My code is simply: However, the Response object returned displays as <Response [432]>, which indicates an HTTP 432 error. As far as I know, that error code is not assigned. When I examine r.text or r.content, there is some HTML which says that it’s

Error ‘Unexpected HTTP code on the target page’, ‘status_code’: 403 when I try to request a json url with a proxy api

I’m trying to scrap this website https://triller.co/ , so I want to get information from profile pages like this https://triller.co/@warnermusicarg , what I do is trying to request the json url that contains the information, in this case it’s https://social.triller.co/v1.5/api/users/by_username/warnermusicarg When I use requests.get() it works normally and I can retrieve all the information. The problem arises when I try

Verification for successful or failed login?

I would like to check if after the request I successfully connected to the site or not. I tried several methods that I know but nothing works. Can someone help me please? Answer If you logged in successfully server side will respond Set-Cookie header with authentication token. Let’s suppose that success header looks like: In this case your code should

How to correctly make Create DM request in Discord API?

I am trying to create dm This code receives response with “400: Bad request” message. I’ve read this but I can’t find any examples of correct usage of this request. Answer I finally understood my mistake, I shouldn’t pass dictionary as data but should pass a str, so I changed data=data to data=json.dumps(data) and it worked

PEM Certificate & TLS Verification against REST api

I have been provided with a pem certificate to authenticate with a third party. Authenticating using certificates is a new concept for me. Inside are two certificates and a private key. The issuer has advised they do not support SSL verification but use TLS(1.1/1.2). I have run a script as below: I’m getting the following error: SSLError: HTTPSConnectionPool(host=’url.com, port=443): Max

Advertisement