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

Add user-agent header to every http request. #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dejano
Copy link

@dejano dejano commented Aug 19, 2017

New api #4 is running behind CloudFlare which requires user-agent header to be sent. If it isn't, response is always 403 with following error message:

The owner of this website (yts.ag) has banned your access based on your browser's signature

New api is running behind CloudFlare which requires user-agent header to be sent. If it isn't, response is always 403 with following error message:

`The owner of this website (yts.ag) has banned your access based on your browser's signature`

public class UserAgentInterceptor implements RequestInterceptor {

private static final String USER_AGENT = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the approach with the interceptor, but I don't think we should use a browser user agent.
I think we should allow the client of the library to customize this. Maybe something like withUserAgent(String)
I will try a few things during the weekend.

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

Successfully merging this pull request may close these issues.

None yet

2 participants