Skip to content

services.sunlightlabs.com requires a User-Agent header #1

@gludington

Description

@gludington

All requests from the java API are getting a 403 forbidden response. It appears that services.sunlightlabs.com requires a User-Agent header. While I could not find any documentation of this requirement on the sunlight API pages, changing this portion of getUrlLines(String url) in ApiCall.java allows requests to succeed:

from:
try {
URL u = new URL(url);
URLConnection yc = u.openConnection();
...

to:
try {
URL u = new URL(url);
HttpURLConnection yc = (HttpURLConnection)u.openConnection();
yc.setRequestProperty("User-Agent", "Sunlight Labs Java API");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions