SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
cf2bdcbc
Commit
cf2bdcbc
authored
5 years ago
by
Jean-Sébastien Caux
Browse files
Options
Downloads
Patches
Plain Diff
debug mailgun_get_stored_messages
parent
9969e62b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apimail/management/commands/mailgun_get_stored_messages.py
+12
-8
12 additions, 8 deletions
apimail/management/commands/mailgun_get_stored_messages.py
with
12 additions
and
8 deletions
apimail/management/commands/mailgun_get_stored_messages.py
+
12
−
8
View file @
cf2bdcbc
...
@@ -32,13 +32,6 @@ class Command(BaseCommand):
...
@@ -32,13 +32,6 @@ class Command(BaseCommand):
if
orphan
.
stored_message
:
if
orphan
.
stored_message
:
# FK link to message created through other event in this loop
# FK link to message created through other event in this loop
continue
continue
response
=
requests
.
get
(
orphan
.
data
[
'
storage
'
][
'
url
'
],
auth
=
(
"
api
"
,
settings
.
MAILGUN_API_KEY
)
)
if
not
response
.
status_code
==
200
:
continue
response
=
response
.
json
()
try
:
try
:
sm
=
StoredMessage
.
objects
.
get
(
sm
=
StoredMessage
.
objects
.
get
(
...
@@ -52,7 +45,18 @@ class Command(BaseCommand):
...
@@ -52,7 +45,18 @@ class Command(BaseCommand):
except
StoredMessage
.
DoesNotExist
:
except
StoredMessage
.
DoesNotExist
:
# Need to create the message
# Need to get and create the message
try
:
storage_url
=
orphan
.
data
[
'
storage
'
][
'
url
'
]
except
KeyError
:
continue
response
=
requests
.
get
(
storage_url
,
auth
=
(
"
api
"
,
settings
.
MAILGUN_API_KEY
)
)
if
not
response
.
status_code
==
200
:
continue
response
=
response
.
json
()
sm
=
StoredMessage
.
objects
.
create
(
sm
=
StoredMessage
.
objects
.
create
(
data
=
response
,
data
=
response
,
datetimestamp
=
parsedate_to_datetime
(
response
[
'
Date
'
]))
datetimestamp
=
parsedate_to_datetime
(
response
[
'
Date
'
]))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment