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

Will pyral support using multiple users? #185

Open
Celthi opened this issue Feb 9, 2022 · 2 comments
Open

Will pyral support using multiple users? #185

Celthi opened this issue Feb 9, 2022 · 2 comments

Comments

@Celthi
Copy link

Celthi commented Feb 9, 2022

I have a program that has two API keys that use to create two separate Rally objects.

rally1 =  Rally(server=server, apikey=apikey1, workspace=workspace, project=project, headers={'version': 'v2.0'})
rally2 = Rally(server=server, apikey=apikey2, workspace=workspace, project=project, headers={'version': 'v2.0'})

It seems that rally1 is not valid and only rally2 is valid. Is it possible that Rally has some global data that is overwritten by creating a second rally object with a different apikey.

@Celthi
Copy link
Author

Celthi commented Feb 9, 2022

I got the following error while creating have multiple connections with different api key

2022-02-09 21:35:18.075 401 b'\n\n<meta http-equiv="Content-Type" content="t' ...

@Celthi
Copy link
Author

Celthi commented Feb 10, 2022

I have found the bug that causes this. In restapi.py, the header is directly assigned by REST_REST_HEADERS. For Python, this REST header is then shared by multiple users, and later users will overwrite others' API key in the header.

The simple fix will be

for k, v in REST_REST_HEADERS.items()):
   self.session.headers[k] = v

Celthi pushed a commit to Celthi/RallyRestToolkitForPython that referenced this issue Feb 10, 2022
@Celthi Celthi changed the title Will pyral support using multiple api keys for multiple users. Will pyral support using multiple api keys Feb 10, 2022
@Celthi Celthi changed the title Will pyral support using multiple api keys Will pyral support using multiple users? Feb 10, 2022
Celthi pushed a commit to Celthi/RallyRestToolkitForPython that referenced this issue Feb 11, 2022
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 a pull request may close this issue.

1 participant