Skip to content

Commit 145f446

Browse files
authored
Merge pull request #427 from knatten/remove-x
Fully stop posting to X (Twitter)
2 parents 65e6267 + c7805f6 commit 145f446

5 files changed

Lines changed: 10 additions & 37 deletions

File tree

quiz/management/commands/auto_publish.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
import datetime
66
from pathlib import Path
77

8-
import tweepy
9-
from django.core.mail import mail_admins
108
from django.core.management.base import BaseCommand
119
from django.utils import timezone
1210

@@ -37,7 +35,6 @@ def handle(self, *args, **options):
3735

3836
def post_to_socials(self, content):
3937
platforms = [
40-
("X", self.post_to_x),
4138
("Bluesky", lambda: self.post_to_bluesky(content)),
4239
("Mastodon", lambda: self.post_to_mastodon(content)),
4340
]
@@ -51,20 +48,6 @@ def post_to_socials(self, content):
5148
traceback.print_exc()
5249
return had_failure
5350

54-
def post_to_x(self):
55-
content = "We just published a new question! Follow us on Bluesky @cppquiz.bsky.social or Mastodon @cppquiz@mastodon.online for updates. For obvious reasons, no longer post to Elon Musk's X."
56-
print(f"Posting to X: '{content}'")
57-
secrets = self.read_secrets()
58-
59-
client = tweepy.Client(
60-
consumer_key=secrets["consumer_key"], consumer_secret=secrets["consumer_secret"],
61-
access_token=secrets["access_token"], access_token_secret=secrets["access_token_secret"],
62-
)
63-
response = client.create_tweet(
64-
text=content
65-
)
66-
post_url = f"https://x.com/user/status/{response.data['id']}"
67-
6851
def post_to_bluesky(self, content):
6952
print(f"Posting to Bluesky: '{content}'")
7053
secrets = self.read_secrets()

quiz/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def clean(self):
7676
if self.state in ('PUB', 'SCH') and self.reserved:
7777
raise ValidationError(f'Cannot {verbs[self.state]} a reserved question')
7878
if self.socials_text and not re.search("https?://", self.socials_text):
79-
raise ValidationError('Tweets must contain a url!')
79+
raise ValidationError('Social media messages must contain a url!')
8080

8181
def save(self, *args, **kwargs):
8282
self.full_clean()

quiz/tests/unit/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def test_requires_url_in_socials_text(self):
5454
q = Question(state="SCH", hint='hint', socials_text="hi", difficulty=1)
5555
with self.assertRaises(ValidationError) as cm:
5656
q.save()
57-
self.assertIn('Tweets must contain a url!', str(cm.exception))
57+
self.assertIn('Social media messages must contain a url!', str(cm.exception))
5858
Question(state="SCH", hint='hint', socials_text="See http://example.com", difficulty=1).save()
5959
Question(state="SCH", hint='hint', socials_text="See https://example.com", difficulty=1).save()
6060

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Django>=5,<6
22
Markdown
3+
requests
34
pymdown-extensions
45
mock
56
parameterized
6-
tweepy
77
autopep8
88
pip-tools
99
pytest

requirements.txt

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.13
2+
# This file is autogenerated by pip-compile with Python 3.14
33
# by the following command:
44
#
55
# pip-compile requirements.in
@@ -10,13 +10,13 @@ autopep8==2.3.2
1010
# via -r requirements.in
1111
build==1.5.0
1212
# via pip-tools
13-
certifi==2026.5.20
13+
certifi==2026.6.17
1414
# via requests
1515
charset-normalizer==3.4.7
1616
# via requests
1717
clang-format==22.1.5
1818
# via -r requirements.in
19-
click==8.4.1
19+
click==8.4.2
2020
# via pip-tools
2121
cssselect==1.4.0
2222
# via splinter
@@ -25,7 +25,7 @@ django==5.2.15
2525
# -r requirements.in
2626
# django-reversion
2727
# splinter
28-
django-reversion==6.2.0
28+
django-reversion==6.3.0
2929
# via -r requirements.in
3030
idna==3.18
3131
# via requests
@@ -39,10 +39,6 @@ markdown==3.10.2
3939
# pymdown-extensions
4040
mock==5.2.0
4141
# via -r requirements.in
42-
oauthlib==3.3.1
43-
# via
44-
# requests-oauthlib
45-
# tweepy
4642
packaging==26.2
4743
# via
4844
# build
@@ -58,13 +54,13 @@ pycodestyle==2.14.0
5854
# via autopep8
5955
pygments==2.20.0
6056
# via pytest
61-
pymdown-extensions==10.21.3
57+
pymdown-extensions==11.0
6258
# via -r requirements.in
6359
pyproject-hooks==1.2.0
6460
# via
6561
# build
6662
# pip-tools
67-
pytest==9.0.3
63+
pytest==9.1.1
6864
# via
6965
# -r requirements.in
7066
# pytest-django
@@ -73,17 +69,11 @@ pytest-django==4.12.0
7369
pyyaml==6.0.3
7470
# via pymdown-extensions
7571
requests==2.34.2
76-
# via
77-
# requests-oauthlib
78-
# tweepy
79-
requests-oauthlib==2.0.0
80-
# via tweepy
72+
# via -r requirements.in
8173
splinter[django]==0.21.0
8274
# via -r requirements.in
8375
sqlparse==0.5.5
8476
# via django
85-
tweepy==4.16.0
86-
# via -r requirements.in
8777
urllib3==2.7.0
8878
# via
8979
# requests

0 commit comments

Comments
 (0)