This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Excerpt for https://github.com/etsy/open-api/issues/27 | |
# Untested, unproven, don't use this in production! | |
def _make_request(method, url, data=None): | |
with open("etsy_token.json", "r") as f: | |
token = json.loads(f.read()) | |
oauth = OAuth2Session(client_id, token=token) | |
oauth.refresh_token( | |
"https://api.etsy.com/v3/public/oauth/token", client_id=client_id | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UnixTimestampField(serializers.FloatField): | |
""" | |
Stores Django datetimes as a Unix timestamp. | |
Thank you to Laur Ivan for the inspiration: | |
https://www.laurivan.com/timestamp-to-datetime-serializer-field-for-drf/ | |
""" | |
def to_internal_value(self, value): | |
""" |
OlderNewer