Skip to content

Commit

Permalink
Merge pull request #3 from mindjolt/ATRIBEC-1369
Browse files Browse the repository at this point in the history
login method updated
  • Loading branch information
gpereyraJC authored Sep 12, 2024
2 parents f823955 + f6fd16a commit d9812a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ jobs:
key: venv-${{ hashFiles('poetry.lock') }}
- name: Install the project dependencies
run: poetry install -q
- name: Run the automated tests
env:
ADJUST_EMAIL: ${{ secrets.ADJUST_EMAIL }}
ADJUST_PASSWORD: ${{ secrets.ADJUST_PASSWORD }}
run: |
echo email=$ADJUST_EMAIL
echo password=$ADJUST_PASSWORD
poetry run pytest --cov=adjust --cov-report xml:coverage.xml -vv
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
7 changes: 7 additions & 0 deletions adjust/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ def _api(self, type: Type[T], path: str, method: str = "GET", **data: Any) -> T:
self._log_in_if_needed()
url = "https://api.adjust.com/" + path
headers = dict(Accept="application/json")

# If logging in, add the authorization token to the headers
if path == "accounts/users/sign_in":
token = data['user']['password']
headers["Authorization"] = f"Token token={token}"
data = None

if not data:
r = self._session.get(url, headers=headers)
elif method == "PUT":
Expand Down

0 comments on commit d9812a2

Please sign in to comment.