Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partial Serach on https://pypi.org/search/?o=&q={searchtext}&page=1 not working - getting error #17345

Open
shivangi4742 opened this issue Jan 1, 2025 · 2 comments
Labels
bug 🐛 requires triaging maintainers need to do initial inspection of issue

Comments

@shivangi4742
Copy link

shivangi4742 commented Jan 1, 2025

const axios = require('axios');
const https = require('https');

const url = 'https://pypi.org/search/?o=&q=po&page=1'; 

const agent = new https.Agent({  
    rejectUnauthorized: false
});

(async () => {
    try {
        const response = await axios.get(url, { httpsAgent: agent });
        console.log('Response:', response.data);
    } catch (error) {
        console.error('An error occurred:', error.message);
    }
})();

This is my code. I am using a VPN, which is why I have set rejectUnauthorized to false. However, I am experiencing the same issue on my personal machine. Now, I am receiving an error in HTML format. This code was working earlier. Please help me out.

Response:

<style> #loading-error { font-size: 16px; font-family: 'Inter', sans-serif; margin-top: 10px; margin-left: 10px; display: none; } </style>
Error Icon JavaScript is disabled in your browser. Please enable JavaScript to proceed.
A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser.
<script> function loadScript(src) { return new Promise((resolve, reject) => { const script = document.createElement('script'); script.onload = resolve; script.onerror = (event) => { console.error('Script load error event:', event); document.getElementById('loading-error').style.display = 'block'; reject( new Error( `Failed to load script: ${src}, Please contact the service administrator.` ) ); }; script.src = src; document.body.appendChild(script); }); }
  loadScript('/_fs-ch-1T1wmsGaOgGaSxcX/errors.js')
    .then(() => {
      const script = document.createElement('script');
      script.src = '/_fs-ch-1T1wmsGaOgGaSxcX/script.js?reload=true';
      script.onerror = (event) => {
        console.error('Script load error event:', event);
        const errorMsg = new Error(
          `Failed to load script: ${script.src}. Please contact the service administrator.`
        );
        console.error(errorMsg);
        handleScriptError();
      };
      document.body.appendChild(script);
    })
    .catch((error) => {
      console.error(error);
    });
</script>
@shivangi4742 shivangi4742 added bug 🐛 requires triaging maintainers need to do initial inspection of issue labels Jan 1, 2025
@shivangi4742 shivangi4742 changed the title Partial Serach on https://pypi.org/search/?o=&q={searchtext}&page=1 Partial Serach on https://pypi.org/search/?o=&q={searchtext}&page=1 not working - getting error Jan 1, 2025
@woodruffw
Copy link
Member

This is expected behavior, please see https://discuss.python.org/t/fastly-interfering-with-pypi-search/73597/13 for more context.

@shivangi4742
Copy link
Author

@woodruffw In my functionality, I need to search for packages using partial names. In the frontend, we allow users to search for a package, and then we call the appropriate API to retrieve a list of matching packages. However, the REST API provided by PyPI does not support partial searches. Therefore, I need to use the API at https://pypi.org/search/?o=&q=po&page=1 to achieve this.

what I do that for that ? any solution?

@Bjwebb @alex @robhudson

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 requires triaging maintainers need to do initial inspection of issue
Projects
None yet
Development

No branches or pull requests

2 participants