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

Forbidden: No user agent has been specified in the request #1

Closed
Stypox opened this issue Feb 10, 2019 · 1 comment
Closed

Forbidden: No user agent has been specified in the request #1

Stypox opened this issue Feb 10, 2019 · 1 comment

Comments

@Stypox
Copy link

Stypox commented Feb 10, 2019

I'm using this snippet to get breaches (copied from the README):

import hibpwned
myApp = hibpwned.Pwned('test@example.com', 'My_App')
myBreaches = myApp.searchAllBreaches()

It doesn't work. Even if I try manually accessing the API using the browser (url https://haveibeenpwned.com/api/v2/breachedaccount/test%40example.com) I get a 403 HTTP error.

I also tried this, but it does not work:

import requests
import urllib
headers = {'User-Agent': 'My_App'}
url = "https://haveibeenpwned.com/api/v2/breachedaccount/%s" % urllib.parse.quote("test@example.com")
response = requests.get(url, headers=headers)
json = response.json()

Is it my internet that has some problems or has the API changed its requirements?

@Stypox
Copy link
Author

Stypox commented Feb 10, 2019

Sorry, it is a problem on my end (I tried from the phone, connected to mobile data and it worked), I'm closing this

@Stypox Stypox closed this as completed Feb 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant