-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from uw-it-aca/develop
Develop
- Loading branch information
Showing
38 changed files
with
1,320 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[run] | ||
branch = True | ||
source = restclients_core | ||
include = restclients_core/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,3 +87,7 @@ ENV/ | |
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# vim... | ||
*.swp | ||
*.swo |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
sudo: false | ||
language: python | ||
python: | ||
- '2.7' | ||
- '3.4' | ||
- '3.5' | ||
- '3.6' | ||
before_script: | ||
- pip install -e . | ||
- pip install pep8 | ||
- pip install nose2 | ||
- pip install coverage | ||
- pip install python-coveralls | ||
- python travis-ci/live_server.py & | ||
script: | ||
- pep8 restclients_core | ||
- RUN_LIVE_TESTS=1 coverage run restclients_core/test.py -v | ||
after_script: | ||
- coveralls | ||
before_deploy: | ||
- find restclients_core/ -name \*.pyc -exec rm {} \; | ||
- echo $TRAVIS_TAG > restclients_core/VERSION | ||
deploy: | ||
provider: pypi | ||
server: https://pypi.python.org/pypi | ||
user: uw-it-aca | ||
skip_cleanup: true | ||
password: | ||
secure: b5gXiqGTuU7DFWYbs6WU7QZPZf2hIJgSk8kGcqNCLBUu/S/Xy8l0FqmheuQPxzzDyi7/RB+MTwC2g5SjmlUqs95YGCKxnSHGt1uUgK4M1zSALUa4SOmpyX50SA73UI2FnX0QLdK3TQhubaBY9bBR3BRd9SNEzSeSCqKA5l8OA6RRTTHxdqKK9mA/nSHz9Khvqx6weIk9+V3ma5dIu06LPDlBmiLqL4JpBw0VXO/izh3gn3CZMUTo7EFOJmh0wW6+4PIstG7paluhgYUO1TasBsGNyV3EVqTxVMAupWhU3542RCdpwApm+/KPljiaFrfgW6QgFa0CgzR2zzGlQkOtD+GgED1RRP0TjyAUtrh19OGP2q/SbZBvO4yohYxwoecepmoXWNHnMaQ1WRK/MEk73pvfMWWyXU9jY4VJP3ogSAz4ACraz68hJ0PSW4yQt5E1iGkUGs8M0SKWWPRUWvz07d7HXCyzIlwxjKa6G4+nb/O3UM+mYoMhemtmz5Gde0r/KtIJKEjtbB8khV8YVxAipzu+6io/qZcUsQX9V0WIdxGQZsEGDm0JICHy+IgD71LWkSco0QcrOZDWN+A5eWfIj48TmzyljAd55uswuMaTpGigpbFGUTdco6jFo8xCqC0PzuLAHGTQRwe1rbnY9G435yqXXKKQoPHTB+94tB3c+8w= | ||
on: | ||
tags: true | ||
python: '3.5' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include restclients_core/VERSION | ||
recursive-include restclients_core * |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
# uw-restclients-core | ||
[![Build Status](https://api.travis-ci.org/uw-it-aca/uw-restclients-core.svg?branch=master)](https://travis-ci.org/uw-it-aca/uw-restclients-core) | ||
[![Coverage Status](https://coveralls.io/repos/uw-it-aca/uw-restclients-core/badge.png?branch=master)](https://coveralls.io/r/uw-it-aca/uw-restclients-core?branch=master) | ||
|
||
uw-restclients-core | ||
=================== | ||
|
||
This module provides useful interfaces for webservice clients. | ||
|
||
If you're writing an application that includes mock resource files, you'll want to include code like this somewhere in your application's startup process: | ||
|
||
``` | ||
from restclients_core.dao import MockDAO | ||
import os | ||
custom_path = os.path.join(abspath(dirname(__file__), "app_resources")) | ||
MockDAO.register_mock_path(custom_path) | ||
``` | ||
|
||
For more information, see https://github.com/uw-it-aca/uw-restclients-core/wiki/Mock-resources | ||
|
||
If you're writing a webservice client, here is some documentation: https://github.com/uw-it-aca/uw-restclients-core/wiki/Writing-a-webservice-client | ||
|
||
If you want to contribute, please send a pull request to the develop branch, or submit an issue. |
Empty file.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class NoCache(object): | ||
""" | ||
A cache implementation that never caches. | ||
""" | ||
def getCache(self, service, url, headers): | ||
return None | ||
|
||
def processResponse(self, service, url, response): | ||
pass |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
""" | ||
This is a class that makes it possible to bulk-save cache entries. | ||
For restclients methods that use threading, this can be used to prevent | ||
innodb gap locks from deadlocking sequential inserts. | ||
""" | ||
|
||
__manage_bulk_inserts = False | ||
__bulk_insert_queue = [] | ||
|
||
|
||
def store_cache_entry(entry): | ||
global __manage_bulk_inserts | ||
global __bulk_insert_queue | ||
|
||
if __manage_bulk_inserts: | ||
__bulk_insert_queue.append(entry) | ||
return | ||
else: | ||
entry.save() | ||
|
||
|
||
def save_all_queued_entries(): | ||
global __bulk_insert_queue | ||
|
||
seen_urls = {} | ||
bulk_create = [] | ||
|
||
try: | ||
for entry in __bulk_insert_queue: | ||
if entry.url not in seen_urls: | ||
entry.save() | ||
seen_urls[entry.url] = True | ||
except Exception as ex: | ||
print "Error bulk saving cache entries: ", ex | ||
|
||
__bulk_insert_queue = [] | ||
|
||
|
||
def enable_cache_entry_queueing(): | ||
global __manage_bulk_inserts | ||
__manage_bulk_inserts = True | ||
|
||
|
||
def disable_cache_entry_queueing(): | ||
global __manage_bulk_inserts | ||
__manage_bulk_inserts = False | ||
save_all_queued_entries() |
Oops, something went wrong.