Skip to content

Commit

Permalink
Merge pull request #45 from Adnuntius/check-headers
Browse files Browse the repository at this point in the history
API Tools V1.11.1
  • Loading branch information
mileshampson authored Feb 22, 2022
2 parents 631d4a8 + 62adade commit 2390458
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .run/TestUtil.run.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="/usr/local/bin/python3.9" />
<option name="SDK_HOME" value="/usr/bin/python3.8" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$/test" />
<option name="IS_MODULE_SDK" value="false" />
<option name="ADD_CONTENT_ROOTS" value="true" />
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Adnuntius AS
Copyright (c) 2022 Adnuntius AS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pip3 install adnuntius
```

All production (not pre-release) releases from this repository are available in Pypi for installation via pip.
You can select a particular version in pip with the `==` operator, for example `pip3 install adnuntius==1.10`
You can select a particular version in pip with the `==` operator, for example `pip3 install adnuntius==1.11.1`

Note that semantic versioning is used for production releases, so major versions indicate incompatible API changes,
minor versions indication additions to the api, and patch versions indicate backwards compatible bug fixes.
Expand All @@ -34,7 +34,7 @@ If you prefer to run in an IDE, an "ExampleLineItem" launcher is included to run
### Test

A test suite is run via github actions on every push.
It can be executed manually via `python3 -m test.test_adnuntius` or the "TestAdnuntius" launcher.
It can be executed manually via `python3 -m test.test_adnuntius` or the "TestAdnuntius" launcher if you have python 3.8+

### Lint

Expand All @@ -43,4 +43,4 @@ It can be installed via pip (`pip install flake8`) and run manually.
The build stopping errors can be seen with `flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics`.
The warnings can be seen with `flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics`

## [Contact Us](https://adnuntius.com/contact-us/)
## [Contact Us](https://adnuntius.com/contact/)
2 changes: 1 addition & 1 deletion adnuntius/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.11"
__version__ = "1.11.1"
9 changes: 5 additions & 4 deletions adnuntius/api.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Api client code for the Adnuntius APIs."""

__copyright__ = "Copyright (c) 2021 Adnuntius AS. All rights reserved."
__copyright__ = "Copyright (c) 2022 Adnuntius AS. All rights reserved."

import json
import os
Expand Down Expand Up @@ -774,15 +774,16 @@ def trigger_conversion(self, conversion_event=None, network_id=None, source_id=N
r = self.session.post(self.__get_base_url(headers) + "/pixelc.gif", data=json.dumps(data), headers=headers)
return r

def trigger_event(self, url):
def trigger_event(self, url, headers=None):
"""
Triggers an event by requesting a URL. Uses the ad-server session so that cookies are shared.
:param url:
:param url: the url to request
:param headers: any additional headers to add to the request
:return:
"""
if url[0:2] == '//':
url = "http:" + url
r = self.session.get(url, allow_redirects=False)
r = self.session.get(url, allow_redirects=False, headers=headers)
return r

def post_event(self, url, event):
Expand Down
2 changes: 1 addition & 1 deletion adnuntius/compare_json.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Utility code to compare json objects."""

__copyright__ = "Copyright (c) 2021 Adnuntius AS. All rights reserved."
__copyright__ = "Copyright (c) 2022 Adnuntius AS. All rights reserved."


def compare_api_json_equal(payload, loaded, ignore, path=[]):
Expand Down
2 changes: 1 addition & 1 deletion adnuntius/util.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Api utilities for the Adnuntius APIs."""

__copyright__ = "Copyright (c) 2021 Adnuntius AS. All rights reserved."
__copyright__ = "Copyright (c) 2022 Adnuntius AS. All rights reserved."

import datetime
import uuid
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
README = (HERE / "README.md").read_text()
setup(
name="adnuntius",
version="1.11",
version="1.11.1",
description="Interface and tools for using the Adnuntius API",
long_description="Interface and tools for using the Adnuntius API",
url="https://github.com/Adnuntius/api-tools",
Expand Down
2 changes: 1 addition & 1 deletion test/example_line_item.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
"""Example code showing the usage of the Adnuntius API to update line items."""

__copyright__ = "Copyright (c) 2021 Adnuntius AS. All rights reserved."
__copyright__ = "Copyright (c) 2022 Adnuntius AS. All rights reserved."

import json
import argparse
Expand Down
2 changes: 1 addition & 1 deletion test/test_adnuntius.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__copyright__ = "Copyright (c) 2021 Adnuntius AS. All rights reserved."
__copyright__ = "Copyright (c) 2022 Adnuntius AS. All rights reserved."

import datetime
import json
Expand Down
2 changes: 1 addition & 1 deletion test/test_helpers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__copyright__ = "Copyright (c) 2021 Adnuntius AS. All rights reserved."
__copyright__ = "Copyright (c) 2022 Adnuntius AS. All rights reserved."

import json
from requests import Response, Session
Expand Down

0 comments on commit 2390458

Please sign in to comment.