Skip to content

Commit

Permalink
Adds api_version property, adds 'Accept-Version' to headers (#512)
Browse files Browse the repository at this point in the history
  • Loading branch information
brownj85 committed Dec 16, 2020
1 parent bbae4bd commit 5fa114d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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

0 comments on commit 5fa114d

Please sign in to comment.