Skip to content

Added authentication support#7

Open
tdickman wants to merge 1 commit intobillyshambrook:masterfrom
tdickman:master
Open

Added authentication support#7
tdickman wants to merge 1 commit intobillyshambrook:masterfrom
tdickman:master

Conversation

@tdickman
Copy link

I added authentication support - I'd love to get this merged, so let me know what I need to do to make that happen. Happy to add tests, etc if needed, just let me know.

Copy link
Owner

@billyshambrook billyshambrook left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @tdickman, sorry about the late response, somehow I missed the notification.

Thanks for catching me not hooking up the auth instance variable!

I have left some comments of some changes before I merge it.

await self._session.close()

async def get(self, *, path=None, params=None):
async def get(self, *, path=None, params={}):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be None as you should not have mutable default arguments - here's a good write up of the side effects (https://pythonconquerstheuniverse.wordpress.com/category/python-gotchas/)

url = posixpath.join(self._base_url, path.strip('/')) if path else self._base_url
url += '.json'
data = json.dumps(value) if value else None
if self._auth:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I allow any arbitrary params to be given in each call, a user may override the auth set when creating the instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants