-
Notifications
You must be signed in to change notification settings - Fork 19
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
Alice python - 3 Integration #20
Open
ParasJain-dev
wants to merge
207
commits into
master
Choose a base branch
from
alice-dev-python3
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 18 commits
Commits
Show all changes
207 commits
Select commit
Hold shift + click to select a range
762ff2a
Alice 3.0 restructuring
ParasJain-dev 351c153
Alice 3.0 integration done/working
ParasJain-dev 753dc5b
Integrated function with actor
ParasJain-dev 6739626
Removed tokens
ParasJain-dev 19f7a40
Removed Token
ParasJain-dev aa2c2c6
Added token rotation on rate limiting
ParasJain-dev 77bde53
Added alternate git token in yaml
ParasJain-dev 5ccf390
Removed redundant data
ParasJain-dev e51c6b4
removed old tokens
ParasJain-dev 637783c
Removed conflict
ParasJain-dev 8bfd8e7
restructured
ParasJain-dev 20a7da5
Corrected yaml file
ParasJain-dev efe76b6
Alice code changed to python 3
ParasJain-dev 68385ee
Python 3 integration done
ParasJain-dev 9e120f6
Changes in yaml file
ParasJain-dev 1288e46
Removed useless files
ParasJain-dev 8e51479
Updated gitignore file
ParasJain-dev cd0fefe
Change pyyaml version to 5.1
ParasJain-dev 150179e
Changed pyyaml in requirements.txt
ParasJain-dev 88e0029
changed shield settings/Added github webhook
ParasJain-dev bd27465
Added shield for commons repo
ParasJain-dev b8b1e9a
Changed code for Request having status parameter
ParasJain-dev 87bdb4a
added code for missing params
ParasJain-dev 7f74e9b
CHanged exception settings
ParasJain-dev 9323ff9
Changed code for closed repo
ParasJain-dev 1c57abf
Chnaged code for moengage repo
ParasJain-dev 5178375
Corrected param dict
ParasJain-dev 30a863b
Major changes
ParasJain-dev 7904444
Removed error
ParasJain-dev 25eae8f
rectify bug
ParasJain-dev 6bca82f
Python3 datetime
ParasJain-dev bd216f7
Fixed api manager issue
ParasJain-dev d566f15
Corrected segmentation error
ParasJain-dev 13e13bb
Change config for constants(Major)
ParasJain-dev 074e8f9
Made file read generic
ParasJain-dev 52eaa7e
FIxed python2 bugs
ParasJain-dev b07a415
Tested and fixed python2 bugs
ParasJain-dev 6710fc8
Refactored code
ParasJain-dev e53ee45
Added check for jenkins on debug
ParasJain-dev 38cde07
Fixed slack issue(naming)
ParasJain-dev 11dc5e4
Changed posttoslackwarning
ParasJain-dev 48b1c19
Fixed issue
ParasJain-dev 1d96526
Fixed issue related to slack
ParasJain-dev 38253d8
Added feature for infra requests
ParasJain-dev deb81e8
Rectified bug of freeze repo
ParasJain-dev 64d19e8
Added git and slack mapping
ParasJain-dev 5ee91b3
Changed username
ParasJain-dev f7cdef9
Added try except for failure catching
ParasJain-dev 59958dc
Changed function call for moengage repo
ParasJain-dev 8836499
Added cases for commons repo
ParasJain-dev f5a8c1d
removed duplicated function
ParasJain-dev f348253
Patch channel name
ParasJain-dev 875d392
Infra-request patch
ParasJain-dev 083c327
Unit test fix
ParasJain-dev ba4e32e
Changed routes for task and issue
ParasJain-dev 8c02152
Dashboard fix
ParasJain-dev 261ed6f
Patch fixer
ParasJain-dev b01aa0b
Changes in constants
ParasJain-dev c56975e
Fixed extracodes
ParasJain-dev 36d8ca7
Added fail safe
ParasJain-dev 4a6602f
added notification for seg repo
ParasJain-dev 5a5b085
Changed username in jenkins
ParasJain-dev 8f7d523
Fixed name in infra reqeust
ParasJain-dev 53aa074
Added new repos in python repo
ParasJain-dev 9166140
Calling close Dangerous pr from function
ParasJain-dev be60fa9
Fixed dangerous pr
ParasJain-dev 5eab231
Changed error message
ParasJain-dev ad9ade7
Added logic for Checking sensitive filed
ParasJain-dev d032bbb
Changes error message
ParasJain-dev c3b6ba5
Commented freeze other repos
ParasJain-dev 2e57aab
Changed pr close message
ParasJain-dev b279b9e
Added hotfix option for close dangerous pr
ParasJain-dev 3d8dc9e
Added message for printing in terminal
ParasJain-dev 30c087b
Added timer for pr to close
ParasJain-dev 70a846e
Added settings for integration test
ParasJain-dev 39d2d21
Updated merge message
ParasJain-dev b278937
Fix parse
ParasJain-dev 57fe37a
Integrated idp-metadata
ParasJain-dev 065c54c
Major shield job change
ParasJain-dev 66060c5
Added fix for other branches
ParasJain-dev af0eaad
Added drone file
ParasJain-dev ed2318d
removed drone file
ParasJain-dev 092ef42
Added option for py and nose test
ParasJain-dev 6afdf7e
Changed channel name
ParasJain-dev 702b3ec
Added code for edited action
ParasJain-dev 5b508c1
Added hotfix
ParasJain-dev 808d9d1
Added code for datapoint repo
ParasJain-dev 23698ea
fix
ParasJain-dev 67f7af2
Fixed recursion when action is edited
ParasJain-dev 5382d96
fixed close pr logic
ParasJain-dev e425361
Create .drone.yml
ParasJain-dev 2fb64f2
Update .drone.yml
ParasJain-dev 829d7a5
Added drone file
ParasJain-dev 21ac8ff
Added drone file
ParasJain-dev 780477a
Added drone file
ParasJain-dev 9994b7e
Update .drone.yml
ParasJain-dev 2a45945
Create a.py
ParasJain-dev 87e8a4e
Delete a.py
ParasJain-dev be3e054
Update .drone.yml
ParasJain-dev 99de9f9
Update .drone.yml
ParasJain-dev 5596549
Update .drone.yml
ParasJain-dev f8b9278
Update .drone.yml
ParasJain-dev c437d1e
Update .drone.yml
ParasJain-dev 103c6e2
Update .drone.yml
ParasJain-dev 3beee50
Update .drone.yml
ParasJain-dev c297bd0
Update .drone.yml
ParasJain-dev 437c1eb
Update .drone.yml
ParasJain-dev 87ee0cb
Update .drone.yml
ParasJain-dev 6579cdb
Update .drone.yml
ParasJain-dev e1e5165
Update .drone.yml
ParasJain-dev 84f9ad1
Update .drone.yml
ParasJain-dev 484e3bd
Update .drone.yml
ParasJain-dev 6157bd7
Update .drone.yml
ParasJain-dev fd2f520
Update .drone.yml
ParasJain-dev bd5d9fe
Update .drone.yml
ParasJain-dev ff0cc07
Update .drone.yml
ParasJain-dev 7c0d364
Update .drone.yml
ParasJain-dev db116c7
Update .drone.yml
ParasJain-dev 69d815e
Update .drone.yml
ParasJain-dev 52242d4
Update .drone.yml
ParasJain-dev 7ea6d2b
Update .drone.yml
ParasJain-dev 1c7303d
Update .drone.yml
ParasJain-dev a14ea31
Update .drone.yml
ParasJain-dev a4c58f4
Update .drone.yml
ParasJain-dev 4d22f25
Update .drone.yml
ParasJain-dev 4ca8e58
Update .drone.yml
ParasJain-dev d36e306
Update .drone.yml
ParasJain-dev 0ae2124
Update .drone.yml
ParasJain-dev f7c21bb
Update .drone.yml
ParasJain-dev 9ea647c
Update .drone.yml
ParasJain-dev 0e70e6c
Update .drone.yml
ParasJain-dev ad2590c
Update .drone.yml
ParasJain-dev 59417fe
Added check for dashboard change
ParasJain-dev 1e482d0
Merge branch 'alice-dev-python3' of github.com:moengage/alice into al…
ParasJain-dev f82f36f
Added new repo oauth2
ParasJain-dev 38491ef
Added drone code
ParasJain-dev 75e114c
Added drone setting
ParasJain-dev 0f3839f
fixed bug
ParasJain-dev 1ce1188
Added security
ParasJain-dev 871bce4
Working alice
ParasJain-dev 8f562a5
Changed messaging format
ParasJain-dev d62a8ec
Changed status
ParasJain-dev 48ae9f4
added security
ParasJain-dev 296549b
Added security for git
ParasJain-dev 8003610
Security fix
ParasJain-dev e467f65
Added encoding
ParasJain-dev a1ef6ba
Converted to str
ParasJain-dev 82b403a
Added string matching
ParasJain-dev d0844f9
Changed jira code
ParasJain-dev aca30a7
Added api test support
ParasJain-dev 8216b86
Commented drone code
ParasJain-dev f1986a7
Added saas repo
ParasJain-dev 9a4273a
Whitelist services for closing in alice
ParasJain-dev 4f9ece2
Removed integration test from moengage
ParasJain-dev e9b0ebb
Added safe check for action= closed
ParasJain-dev 572492b
Removed check to stop integration test
ParasJain-dev 6ef5657
Added dash repo
ParasJain-dev 734cff3
Added check for partial branch
ParasJain-dev b7c19d1
Added sensitive branch code
ParasJain-dev 7343476
Resoleved bug
ParasJain-dev 2e45196
changed .gitignore
ParasJain-dev 1142b61
Added moedatascience
ParasJain-dev 2733145
Added exception handling
ParasJain-dev 32053b3
Added skip status for Java repo
ParasJain-dev e6c5f96
Added context for java
ParasJain-dev c6e1726
Added user_profile
ParasJain-dev 61c7c39
Added support for new repos
ParasJain-dev 6700e47
Added skip test for dependent bot
ParasJain-dev 01a0356
Added shield triggers for edit action
ParasJain-dev dc2f42e
revert
ParasJain-dev a0dedd8
Again added feature
ParasJain-dev eecb0d8
added ami change code
ParasJain-dev e28da75
Added shield
ParasJain-dev fe7ffb5
Added message
ParasJain-dev a039e4d
Added for sensitive check
ParasJain-dev e081d71
Added code for limiting alerting
ParasJain-dev ba64a68
Added print message
ParasJain-dev a823e7e
Added comments and sleep
ParasJain-dev 5a85f8e
CHanged channel
ParasJain-dev 7d0244c
Added label
ParasJain-dev 04166c7
Fixed issue
ParasJain-dev 4ca6ed1
Updated channel name
ParasJain-dev 6c295bf
Added error message for HTTP erro
ParasJain-dev f046a8d
Changed lint path issue
ParasJain-dev d62f8fe
Reduced no of calls to external service to 3x
ParasJain-dev d0da9b1
Replace weekly release to releases
ParasJain-dev 9be28c4
changed channel name
ParasJain-dev 21a837c
new integration for cards repo
37196dd
Added version change for moengage
ParasJain-dev 1901162
Merge branch 'alice-dev-python3' of https://github.com/moengage/alice…
25e3994
Rectified code
ParasJain-dev dabfdbf
Merge branch 'alice-dev-python3' of https://github.com/moengage/alice…
9ec6142
Added success status
ParasJain-dev 9cb0e6e
Merge branch 'alice-dev-python3' of https://github.com/moengage/alice…
210d6cf
changed context name
4f4d908
Added check to run only for moengage
ParasJain-dev 6ca9c9d
merge change
ParasJain-dev d6d6d3d
changed context
ParasJain-dev 0339c7c
ADded email-campaign repo in release checklist
ParasJain-dev c0aaf56
removed dashboard builder prod
ParasJain-dev d8c7c69
added campaign reports repo
ParasJain-dev f0b9de8
commented slack alert
ParasJain-dev 9f9c996
slack helper commented
ParasJain-dev 5e1e830
commented inapp rest service job
ParasJain-dev ad2f2c5
ami change commented
ParasJain-dev 20092c7
Adding support master py2 dev py3 (#27)
habin-163 32990ff
Adding support master py2 dev py3 (#28)
habin-163 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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
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
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,16 +1,40 @@ | ||
import requests | ||
import json | ||
from alice.config.config_provider import ConfigProvider | ||
|
||
|
||
class ApiManager(object): | ||
""" | ||
Get function is used for making get calls | ||
Post function is used for making Post calls | ||
Check function is used for token rotation when we get rate limiting. | ||
Check function is called in get and post function for checking and rotating the token. | ||
""" | ||
|
||
@staticmethod | ||
def get(url, headers, data=None): | ||
response = requests.get(url, headers=headers, data=data) | ||
response = ApiManager.check(response, url, headers, data, "get") | ||
return {"status_code": response.status_code, "content": response.content, "response": response} | ||
|
||
|
||
@staticmethod | ||
def post(url, headers, data=None): | ||
pass | ||
response = requests.post(url, headers=headers, data=data) | ||
response = ApiManager.check(response, url, headers, data, "post") | ||
return {"status_code": response.status_code, "content": response.content, "response": response} | ||
|
||
@staticmethod | ||
def check(response, url, headers, data, request_type): | ||
response_data = json.loads(response.content) | ||
if type(response_data) is dict and "message" in response_data and "documentation_url" in response_data: | ||
token = ConfigProvider().github_alternate_token | ||
headers["Authorization"] = "token %s"%token | ||
if request_type == "get": | ||
response = requests.get(url, headers=headers, data=data) | ||
else: | ||
response = requests.post(url, headers=headers, data=data) | ||
return response | ||
else: | ||
return response | ||
|
||
|
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
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.load need not be replaced with .safe_load?