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

Adds api_version property, adds 'Accept-Version' to headers #512

Merged
merged 3 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@

<h3>Improvements</h3>

* `Connection` objects now send versioned requests to the platform API.
[(#512)](https://github.com/XanaduAI/strawberryfields/pull/512)

* The `copies` option when constructing a `TDMProgram` have been removed. Instead, the number of
copies of a TDM algorithm can now be set by passing the `shots` keyword argument to
the `eng.run()` method.
Expand Down Expand Up @@ -92,7 +95,7 @@

This release contains contributions from (in alphabetical order):

Theodor Isacsson, Josh Izaac, Fabian Laudenbach, Nicolas Quesada, Antal Száva.
Jack Brown, Theodor Isacsson, Josh Izaac, Fabian Laudenbach, Nicolas Quesada, Antal Száva.

# Release 0.16.0 (current release)

Expand Down
7 changes: 6 additions & 1 deletion strawberryfields/api/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,15 @@ def __init__(
self._verbose = verbose

self._base_url = "http{}://{}:{}".format("s" if self.use_ssl else "", self.host, self.port)
self._headers = {"Authorization": self.token}
self._headers = {"Authorization": self.token, "Accept-Version": self.api_version}

self.log = create_logger(__name__)

@property
def api_version(self) -> str:
"""str: The platform API version to request."""
return "1.0.0"

@property
def token(self) -> str:
"""The API authentication token.
Expand Down