Git Product home page Git Product logo

Comments (4)

NabiKAZ avatar NabiKAZ commented on May 18, 2024 2

@ElPapi89
I do not see anything of this project and curl_chrome99 command in your code.
If you plan to run it in Python. You must first compile this project or launch Docker for it and make sure that the following command on the command line gives the correct result:

curl_chrome99 'https://api.pegaxy.io/rent/0?rentMode=SHARE_PROFIT'
or
docker run --rm lwthiker/curl-impersonate:0.4-chrome curl_chrome99 https://api.pegaxy.io/rent/0?rentMode=SHARE_PROFIT

Then, with the help of shell command methods, call it in Python. For example, something like this:

import subprocess
p = subprocess.Popen("curl_chrome99 https://api.pegaxy.io/rent/0?rentMode=SHARE_PROFIT", stdout=subprocess.PIPE, shell=True)
print(p.communicate())

Or other methods mentioned in this article, for example:
https://www.the-analytics.club/python-shell-commands

from curl-impersonate.

lwthiker avatar lwthiker commented on May 18, 2024 1

Hi,

When you use the wrapper scripts (e.g. curl_chrome99) all the default Chrome headers are already added for you. You can look at the script: it is a simple wrapper around the curl-impersonate binary that sets the ciphers, HTTP headers and a few other options. They way you have used the script causes the headers to be added twice, which might be the reason that Cloudflare blocks you.

Try simply running:

curl_chrome99 'https://api.pegaxy.io/my/info'

If you need to change any of the hard-coded headers, the way to go should be modifying the script.

Let me know if that works so I know whether I can close this issue.

from curl-impersonate.

NabiKAZ avatar NabiKAZ commented on May 18, 2024

Thanks. No problem right now. If the problem is repeated, I will leave the message again.

from curl-impersonate.

ElPapi89 avatar ElPapi89 commented on May 18, 2024

A.Z.,

Im trying to acess pegaxy api and its impossibl. i tried add headers e sessio, but nothing. can u help me? i saw ur post about the that.

import requests
import json

url = "https://api.pegaxy.io/rent/0?rentMode=SHARE_PROFIT"

headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0' ,
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' ,
'Accept-Language': 'en-US,en;q=0.5' ,
'Connection': 'keep-alive' ,
'Upgrade-Insecure-Requests': '1' ,
'Sec-Fetch-Dest': 'document' ,
'Sec-Fetch-Mode': 'navigate' ,
'Sec-Fetch-Site': 'none' ,
'Sec-Fetch-User': '?1', 
'Pragma': 'no-cache' ,
'Cache-Control': 'no-cache'
}


response = requests.get(url, headers=headers)
response.raise_for_status()  # raises exception when not a 2xx response
if response.status_code != 204:
   return response.json()
response

Im getting this error

HTTPError: 403 Client Error: Forbidden for url: https://api.pegaxy.io/rent/0?rentMode=SHARE_PROFIT

Thanks

from curl-impersonate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.