Merge pull request #104 from codl/fix-string-ids
fix string id support to also include in_reply_to_... fields
This commit is contained in:
commit
52d57d9d43
S'han modificat 1 arxius amb 8 adicions i 11 eliminacions
|
@ -17,6 +17,7 @@ import re
|
||||||
import copy
|
import copy
|
||||||
import threading
|
import threading
|
||||||
import sys
|
import sys
|
||||||
|
import six
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
@ -1083,15 +1084,11 @@ class Mastodon:
|
||||||
"""
|
"""
|
||||||
Converts json string IDs to native python bignums.
|
Converts json string IDs to native python bignums.
|
||||||
"""
|
"""
|
||||||
if sys.version_info.major >= 3:
|
for key in ('id', 'in_reply_to_id', 'in_reply_to_account_id'):
|
||||||
str_type = str
|
if (key in json_object and
|
||||||
else:
|
isinstance(json_object[key], six.text_type)):
|
||||||
str_type = unicode
|
|
||||||
|
|
||||||
if ('id' in json_object and
|
|
||||||
isinstance(json_object['id'], str_type)):
|
|
||||||
try:
|
try:
|
||||||
json_object['id'] = int(json_object['id'])
|
json_object[key] = int(json_object[key])
|
||||||
except ValueError:
|
except ValueError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
Loading…
Referencia en una nova incidència