Skip to content

Support for EU/AU regions #9

@eliemada

Description

@eliemada

Currently the API base URL is hardcoded to a single region:

API_BASE_URL = "https://eu.edstem.org/api/"

This means users on other regions (US, AU) need to manually edit the source.

Proposal:

Add a region parameter to EdAPI.__init__:

class EdAPI:
    def __init__(self, region: str = "us"):
        subdomain = "" if region == "us" else f"{region}."
        self.api_base_url = f"https://{subdomain}edstem.org/api/"
        self.static_file_base_url = f"https://static.{subdomain}edusercontent.com/files/"
        # ...

Then update all urljoin(API_BASE_URL, ...) calls to use self.api_base_url.

Happy to submit a PR if you're open to this.

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