import pywikibot
from pywikibot import pagegenerators

wikidata_site = pywikibot.Site('wikidata', 'wikidata')
repo = wikidata_site.data_repository()

limit = None

mainProp = 'P39'
mainValue = 'Q27169'
qualProp = 'P768'
fromQualValue = 'Q19113443'
toQualValue = 'Q38'

dataset_query = """SELECT ?item WHERE {{ ?item p:{} [ ps:{} wd:{}; pq:{} wd:{} ] }}""".format(mainProp, mainProp, mainValue, qualProp, fromQualValue)
for itemkey in pagegenerators.WikidataSPARQLPageGenerator(dataset_query, site=wikidata_site):
    inputdata.append(itemkey.title())

for i, item in enumerate(inputdata):
    changedQualifiers = 0
    
    Qitem = pywikibot.ItemPage(repo, item)
    Qitem.get()
    
    QitemJSON = Qitem.toJSON()
    print('== {} ({}/{}) =='.format(Qitem.title(), i+1, len(inputdata)))
    
    if not 'claims' in QitemJSON:
        continue
    if not mainProp in QitemJSON['claims']:
        continue
    for j, entity in enumerate(QitemJSON['claims'][mainProp]):
        if QitemJSON['claims'][mainProp][j]['mainsnak']['datavalue']['value']['numeric-id'] != int(mainValue[1:]):
            continue
        if not 'qualifiers' in QitemJSON['claims'][mainProp][j]:
            continue
        if not qualProp in QitemJSON['claims'][mainProp][j]['qualifiers']:
            continue
        for k, entity in enumerate(QitemJSON['claims'][mainProp][j]['qualifiers'][qualProp]):
            if QitemJSON['claims'][mainProp][j]['qualifiers'][qualProp][k]['datavalue']['value']['numeric-id'] == int(fromQualValue[1:]):
                QitemJSON['claims'][mainProp][j]['qualifiers'][qualProp][k]['datavalue']['value']['numeric-id'] = int(toQualValue[1:])
                changedQualifiers += 1
    
    if changedQualifiers > 0:
        Qitem.editEntity(QitemJSON, summary='move [[Property:{}]] qualifier value on [[Property:{}]] claim from [[{}]] to [[{}]]'.format(qualProp, mainProp, fromQualValue, toQualValue))
        print('* Changed {} qualifier(s)'.format(changedQualifiers))
    else:
        print('* Nothing to do')

    if limit != None and i+1 >= limit:
        print()
        print('Limit of {} reached; stop here'.format(limit))
        break
    
print('All done, task finished')
== Q196562 ==
== Q11860 ==
* Nothing to do
== Q3616115 ==
* Nothing to do
== Q2528704 ==
* Nothing to do
== Q517161 ==
* Nothing to do
== Q3750098 ==
* Nothing to do
== Q1132305 ==
* Nothing to do
== Q3749833 ==
* Nothing to do
== Q3609104 ==
* Nothing to do
== Q1236400 ==
* Nothing to do
== Q547449 ==
* Nothing to do
== Q3610018 ==
* Nothing to do
== Q3724464 ==
* Nothing to do
== Q3766017 ==
* Nothing to do
== Q488754 ==
* Nothing to do
== Q1334761 ==
* Changed 1 qualifiers
== Q3659847 ==
* Changed 1 qualifiers
== Q3760943 ==
* Changed 2 qualifiers
== Q367511 ==
* Changed 2 qualifiers
== Q684295 ==
* Changed 1 qualifiers
== Q17420721 ==
* Changed 3 qualifiers
== Q559577 ==
* Changed 2 qualifiers
== Q1111570 ==
* Changed 1 qualifiers
== Q3712959 ==
* Changed 1 qualifiers
== Q47547 ==
* Changed 1 qualifiers
== Q3721452 ==
* Changed 1 qualifiers
== Q3767788 ==
* Changed 1 qualifiers
== Q3769950 ==
* Changed 1 qualifiers
== Q558810 ==
* Changed 2 qualifiers
== Q3847412 ==
* Changed 1 qualifiers
== Q3497963 ==
* Changed 1 qualifiers
== Q2252913 ==
* Changed 1 qualifiers
== Q3939177 ==
* Changed 2 qualifiers
== Q3615827 ==
* Changed 1 qualifiers
== Q3619876 ==
* Changed 1 qualifiers
== Q3851209 ==
* Changed 1 qualifiers
== Q3749867 ==
* Changed 1 qualifiers
== Q3751362 ==
* Changed 1 qualifiers
== Q583545 ==
* Changed 1 qualifiers
== Q3619680 ==
* Changed 1 qualifiers
== Q4013576 ==
* Changed 1 qualifiers
== Q3846514 ==
* Changed 1 qualifiers
== Q3839410 ==
* Changed 1 qualifiers
== Q3721795 ==
* Changed 1 qualifiers
== Q436123 ==
* Changed 3 qualifiers
== Q3838897 ==
* Changed 2 qualifiers
== Q3860840 ==
* Changed 1 qualifiers
== Q744324 ==
* Changed 1 qualifiers
== Q558815 ==
* Changed 1 qualifiers
== Q3779986 ==
* Changed 1 qualifiers
== Q1042010 ==
* Changed 4 qualifiers
== Q434786 ==
* Changed 1 qualifiers
== Q552229 ==
* Changed 2 qualifiers
== Q3768181 ==
* Changed 1 qualifiers
== Q493714 ==
* Changed 1 qualifiers
== Q948169 ==
* Changed 1 qualifiers
== Q1072333 ==
* Changed 1 qualifiers
== Q15930092 ==
* Changed 1 qualifiers
== Q3893103 ==
* Changed 2 qualifiers
== Q3619895 ==
* Changed 1 qualifiers
== Q1130103 ==
* Changed 1 qualifiers
== Q453848 ==
* Changed 1 qualifiers
== Q3767808 ==
* Changed 1 qualifiers
== Q3798977 ==
* Changed 1 qualifiers
== Q2249674 ==
* Changed 2 qualifiers
== Q17420806 ==
* Changed 1 qualifiers
== Q3615576 ==
* Changed 1 qualifiers
== Q3934473 ==
* Changed 1 qualifiers
== Q719360 ==
* Changed 2 qualifiers
== Q3417325 ==
* Changed 1 qualifiers
== Q3769694 ==
* Changed 1 qualifiers
== Q3771634 ==
* Changed 1 qualifiers
== Q3886985 ==
* Changed 1 qualifiers
== Q3362598 ==
* Changed 2 qualifiers
== Q3840240 ==
* Changed 1 qualifiers
== Q3779392 ==
* Changed 1 qualifiers
== Q3762885 ==
* Changed 1 qualifiers
== Q3847960 ==
* Changed 1 qualifiers
== Q3960891 ==
* Changed 1 qualifiers
== Q3846928 ==
* Changed 1 qualifiers
== Q671532 ==
* Changed 1 qualifiers
== Q3935910 ==
* Changed 2 qualifiers
== Q3905291 ==
* Changed 2 qualifiers
== Q3613872 ==
* Changed 1 qualifiers
== Q3750455 ==
* Changed 2 qualifiers
== Q3847552 ==
* Changed 1 qualifiers
== Q3932712 ==
* Changed 1 qualifiers
== Q550363 ==
* Changed 1 qualifiers
== Q445685 ==
* Changed 1 qualifiers
== Q3749360 ==
* Changed 1 qualifiers
== Q340239 ==
* Changed 2 qualifiers
== Q737794 ==
* Changed 1 qualifiers
== Q3659902 ==
* Changed 1 qualifiers
== Q3779498 ==
* Changed 2 qualifiers
== Q3765330 ==
* Changed 1 qualifiers
== Q3769638 ==
* Changed 2 qualifiers
== Q1083986 ==
* Changed 1 qualifiers
== Q3619732 ==
* Changed 1 qualifiers
== Q3658941 ==
* Changed 2 qualifiers
== Q3751233 ==
* Changed 1 qualifiers
== Q3764747 ==
* Changed 1 qualifiers
== Q312058 ==
* Changed 2 qualifiers
== Q2847139 ==
* Changed 1 qualifiers
== Q3771063 ==
* Changed 2 qualifiers
== Q601298 ==
* Changed 2 qualifiers
== Q3839249 ==
* Changed 2 qualifiers
== Q3750881 ==
* Changed 1 qualifiers
== Q3762149 ==
* Changed 1 qualifiers
== Q3611393 ==
* Changed 1 qualifiers
== Q3909566 ==
* Changed 1 qualifiers
== Q1122937 ==
* Changed 1 qualifiers
== Q1696496 ==
* Changed 1 qualifiers
== Q3760928 ==
* Changed 1 qualifiers
== Q3875891 ==
* Changed 1 qualifiers
== Q556191 ==
* Changed 1 qualifiers
== Q3840256 ==
* Changed 2 qualifiers
== Q4013395 ==
* Changed 2 qualifiers
== Q3886220 ==
* Changed 1 qualifiers
== Q11698554 ==
* Changed 1 qualifiers
== Q1060314 ==
* Changed 1 qualifiers
== Q9268406 ==
* Changed 1 qualifiers
== Q693317 ==
* Changed 2 qualifiers
== Q3721200 ==
* Changed 1 qualifiers
== Q3838724 ==
* Changed 2 qualifiers
== Q3849036 ==
* Changed 1 qualifiers
== Q3848979 ==
* Changed 1 qualifiers
== Q3702554 ==
* Changed 2 qualifiers
== Q1055212 ==
* Changed 1 qualifiers
== Q780885 ==
* Changed 3 qualifiers
== Q319547 ==
* Changed 1 qualifiers
== Q551188 ==
* Changed 1 qualifiers
== Q663538 ==
* Changed 2 qualifiers
== Q1055220 ==
* Changed 3 qualifiers
== Q3726658 ==
* Changed 1 qualifiers
== Q3835605 ==
* Changed 1 qualifiers
== Q3769568 ==
* Changed 1 qualifiers
== Q3611490 ==
* Changed 1 qualifiers
== Q695075 ==
* Changed 2 qualifiers
== Q3619518 ==
* Changed 2 qualifiers
== Q3844718 ==
* Changed 1 qualifiers
== Q3609180 ==
* Changed 1 qualifiers
== Q3992004 ==
* Changed 1 qualifiers
== Q466836 ==
* Changed 1 qualifiers
== Q3742139 ==
* Changed 1 qualifiers
== Q1553555 ==
* Changed 1 qualifiers
== Q3874743 ==
* Changed 1 qualifiers
== Q1055262 ==
* Changed 2 qualifiers
== Q276023 ==
* Changed 1 qualifiers
== Q3852744 ==
* Changed 1 qualifiers
== Q159648 ==
* Changed 2 qualifiers
== Q3733864 ==
* Changed 1 qualifiers
== Q722610 ==
* Changed 2 qualifiers
== Q3938722 ==
* Changed 2 qualifiers
== Q1053244 ==
* Changed 1 qualifiers
== Q2094471 ==
* Changed 1 qualifiers
== Q3767884 ==
* Changed 2 qualifiers
== Q3756943 ==
* Changed 2 qualifiers
== Q441086 ==
* Changed 2 qualifiers
== Q3771422 ==
* Changed 1 qualifiers
== Q433628 ==
* Changed 1 qualifiers
== Q1098092 ==
* Changed 2 qualifiers
== Q234771 ==
* Changed 1 qualifiers
== Q3619122 ==
* Changed 1 qualifiers
== Q3893565 ==
* Changed 1 qualifiers
== Q1394911 ==
* Changed 2 qualifiers
== Q3617117 ==
* Changed 1 qualifiers
== Q11714113 ==
* Changed 1 qualifiers
== Q1220 ==
* Changed 2 qualifiers
== Q3845641 ==
* Changed 1 qualifiers
== Q12973043 ==
* Changed 1 qualifiers
== Q3743804 ==
* Changed 2 qualifiers
== Q3609131 ==
* Changed 2 qualifiers
== Q3611195 ==
* Changed 1 qualifiers
== Q3768548 ==
* Changed 2 qualifiers
== Q3751164 ==
* Changed 2 qualifiers
== Q192818 ==
* Changed 2 qualifiers
== Q1077655 ==
* Changed 1 qualifiers
== Q3702196 ==
* Changed 1 qualifiers
== Q317142 ==
* Changed 1 qualifiers
== Q3746504 ==
* Changed 1 qualifiers
== Q3608321 ==
* Changed 1 qualifiers
== Q776886 ==
* Changed 1 qualifiers
== Q3840472 ==
* Changed 1 qualifiers
== Q949306 ==
* Changed 1 qualifiers
== Q3848931 ==
* Changed 1 qualifiers
== Q3751333 ==
* Changed 1 qualifiers
== Q3838684 ==
* Changed 1 qualifiers
== Q3903996 ==
* Changed 1 qualifiers
== Q3848527 ==
* Changed 2 qualifiers
== Q4007856 ==
* Changed 1 qualifiers
== Q1346627 ==
* Changed 2 qualifiers
== Q2002390 ==
* Changed 2 qualifiers
== Q701570 ==
* Changed 1 qualifiers
== Q3611466 ==
* Changed 1 qualifiers
== Q3763030 ==
* Changed 1 qualifiers
== Q3881851 ==
* Changed 2 qualifiers
== Q3713129 ==
* Changed 1 qualifiers
== Q11686500 ==
* Changed 1 qualifiers
== Q3847447 ==
* Changed 1 qualifiers
== Q3766909 ==
* Changed 1 qualifiers
== Q4014523 ==
* Changed 1 qualifiers
== Q3847266 ==
* Changed 1 qualifiers
== Q68050 ==
* Changed 1 qualifiers
== Q1690028 ==
* Changed 3 qualifiers
== Q1055587 ==
* Changed 1 qualifiers
== Q17420892 ==
* Changed 1 qualifiers
== Q3768259 ==
* Changed 2 qualifiers
== Q617639 ==
* Changed 1 qualifiers
== Q1426951 ==
* Changed 1 qualifiers
== Q3766525 ==
* Changed 1 qualifiers
== Q316288 ==
* Changed 1 qualifiers
== Q5444 ==
* Changed 1 qualifiers
== Q446679 ==
* Changed 1 qualifiers
== Q4308879 ==
* Changed 1 qualifiers
== Q3751239 ==
* Changed 1 qualifiers
== Q4003346 ==
* Changed 1 qualifiers
== Q3658942 ==
* Changed 1 qualifiers
== Q939831 ==
* Changed 1 qualifiers
== Q3659874 ==
* Changed 1 qualifiers
== Q3749420 ==
* Changed 1 qualifiers
== Q386491 ==
* Changed 1 qualifiers
== Q327879 ==
* Changed 1 qualifiers
== Q3765105 ==
* Changed 1 qualifiers
== Q380297 ==
* Changed 1 qualifiers
== Q1077663 ==
* Changed 1 qualifiers
== Q3645753 ==
* Changed 2 qualifiers
== Q2307679 ==
* Changed 1 qualifiers
== Q3617684 ==
* Changed 1 qualifiers
== Q3762932 ==
* Changed 2 qualifiers
== Q286469 ==
* Changed 2 qualifiers
== Q3846003 ==
* Changed 2 qualifiers
== Q17420692 ==
* Changed 1 qualifiers
== Q446794 ==
* Changed 1 qualifiers
== Q1441240 ==
* Changed 6 qualifiers
== Q3856564 ==
* Changed 1 qualifiers
== Q441294 ==
* Changed 2 qualifiers
== Q3839265 ==
* Changed 1 qualifiers
== Q3732191 ==
* Changed 1 qualifiers
== Q946114 ==
* Changed 1 qualifiers
== Q3645960 ==
* Changed 2 qualifiers
== Q3756679 ==
* Changed 1 qualifiers
== Q3838497 ==
* Changed 6 qualifiers
== Q922336 ==
* Changed 2 qualifiers
== Q3836935 ==
* Changed 1 qualifiers
== Q943880 ==
* Changed 2 qualifiers
== Q11699582 ==
* Changed 1 qualifiers
== Q3388071 ==
* Changed 1 qualifiers
== Q3608446 ==
* Changed 2 qualifiers
== Q1055575 ==
* Changed 1 qualifiers
== Q3756651 ==
* Changed 1 qualifiers
== Q164995 ==
* Changed 1 qualifiers
== Q1378016 ==
* Changed 2 qualifiers
== Q661580 ==
* Changed 1 qualifiers
== Q3388783 ==
* Changed 1 qualifiers
== Q161933 ==
* Changed 1 qualifiers
== Q680190 ==
* Changed 4 qualifiers
== Q2248530 ==
* Changed 1 qualifiers
== Q473591 ==
* Changed 1 qualifiers
== Q3726712 ==
* Changed 3 qualifiers
== Q3849081 ==
* Changed 1 qualifiers
== Q3839798 ==
* Changed 1 qualifiers
== Q559513 ==
* Changed 1 qualifiers
== Q2391857 ==
* Changed 1 qualifiers
== Q703503 ==
* Changed 1 qualifiers
== Q17420840 ==
* Changed 1 qualifiers
== Q3726627 ==
* Changed 1 qualifiers
== Q4454559 ==
* Changed 1 qualifiers
== Q3658825 ==
* Changed 2 qualifiers
== Q3679928 ==
* Changed 1 qualifiers
== Q3938973 ==
* Changed 1 qualifiers
== Q3933028 ==
* Changed 3 qualifiers
== Q3665405 ==
* Changed 1 qualifiers
== Q3749361 ==
* Changed 1 qualifiers
== Q3619035 ==
* Changed 2 qualifiers
== Q714299 ==
* Changed 1 qualifiers
== Q3767373 ==
* Changed 2 qualifiers
== Q1148719 ==
* Changed 1 qualifiers
== Q3877211 ==
* Changed 2 qualifiers
== Q3749591 ==
* Changed 1 qualifiers
== Q3609965 ==
* Changed 1 qualifiers
== Q3623486 ==
* Changed 1 qualifiers
== Q1056622 ==
* Changed 1 qualifiers
== Q3846483 ==
* Changed 1 qualifiers
== Q3852796 ==
* Changed 2 qualifiers
== Q3848803 ==
* Changed 1 qualifiers
== Q122345 ==
* Changed 1 qualifiers
== Q458709 ==
* Changed 1 qualifiers
== Q596847 ==
* Changed 1 qualifiers
== Q1243366 ==
* Changed 2 qualifiers
== Q3938694 ==
* Changed 1 qualifiers
== Q316226 ==
* Changed 3 qualifiers
== Q1055415 ==
* Changed 1 qualifiers
== Q730921 ==
* Changed 1 qualifiers
== Q3762266 ==
* Changed 2 qualifiers
== Q2246867 ==
* Changed 1 qualifiers
== Q1285166 ==
* Changed 1 qualifiers
== Q3606788 ==
* Changed 1 qualifiers
== Q4000296 ==
* Changed 1 qualifiers
== Q957368 ==
* Changed 1 qualifiers
== Q3765722 ==
* Changed 2 qualifiers
== Q3847318 ==
* Changed 1 qualifiers
== Q3870675 ==
* Changed 1 qualifiers
== Q17420713 ==
* Changed 1 qualifiers
== Q3011640 ==
* Changed 1 qualifiers
== Q1970552 ==
* Changed 3 qualifiers
== Q11698779 ==
* Changed 1 qualifiers
== Q369756 ==
* Changed 1 qualifiers
== Q2674713 ==
* Changed 1 qualifiers
== Q3848640 ==
* Changed 1 qualifiers
== Q1082039 ==
* Changed 2 qualifiers
== Q2755156 ==
* Changed 2 qualifiers
== Q3650961 ==
* Changed 1 qualifiers
== Q47583 ==
* Changed 3 qualifiers
== Q3763648 ==
* Changed 1 qualifiers
== Q434308 ==
* Changed 1 qualifiers
== Q3933008 ==
* Changed 1 qualifiers
== Q3442291 ==
* Changed 1 qualifiers
== Q3903645 ==
* Changed 1 qualifiers
== Q9268267 ==
* Changed 1 qualifiers
== Q667530 ==
* Changed 1 qualifiers
== Q922984 ==
* Changed 1 qualifiers
== Q597551 ==
* Changed 1 qualifiers
== Q4013310 ==
* Changed 2 qualifiers
== Q3750137 ==
* Changed 1 qualifiers
== Q3830081 ==
* Changed 1 qualifiers
== Q15630809 ==
* Changed 1 qualifiers
== Q3852825 ==
* Changed 1 qualifiers
== Q3618333 ==
* Changed 1 qualifiers
== Q11802785 ==
* Changed 1 qualifiers
== Q452916 ==
* Changed 2 qualifiers
== Q1737249 ==
* Changed 1 qualifiers
== Q1055625 ==
* Changed 1 qualifiers
== Q7671929 ==
* Changed 1 qualifiers
== Q3938598 ==
* Changed 3 qualifiers
== Q780012 ==
* Changed 1 qualifiers
== Q3848590 ==
* Changed 1 qualifiers
== Q3847082 ==
* Changed 2 qualifiers
== Q4015256 ==
* Changed 1 qualifiers
== Q3762238 ==
* Changed 1 qualifiers
== Q4009815 ==
* Changed 2 qualifiers
== Q3942536 ==
* Changed 1 qualifiers
== Q3924306 ==
* Changed 1 qualifiers
== Q3847368 ==
* Changed 2 qualifiers
== Q2232182 ==
* Changed 2 qualifiers
== Q3608624 ==
* Changed 1 qualifiers
== Q3839918 ==
* Changed 2 qualifiers
== Q2460954 ==
* Changed 2 qualifiers
== Q3742166 ==
* Changed 2 qualifiers
== Q1892362 ==
* Changed 1 qualifiers
== Q3885576 ==
* Changed 1 qualifiers
== Q664465 ==
* Changed 2 qualifiers
== Q3745874 ==
* Changed 1 qualifiers
== Q607219 ==
* Changed 1 qualifiers
== Q3484063 ==
* Changed 1 qualifiers
== Q3734397 ==
* Changed 1 qualifiers
== Q3766816 ==
* Changed 2 qualifiers
== Q3847377 ==
* Changed 3 qualifiers
== Q3719660 ==
* Changed 1 qualifiers
== Q47651 ==
* Changed 6 qualifiers
== Q3619561 ==
* Changed 1 qualifiers
== Q3929575 ==
* Changed 1 qualifiers
== Q189307 ==
* Changed 1 qualifiers
== Q1553527 ==
* Changed 2 qualifiers
== Q3933076 ==
* Changed 2 qualifiers
== Q1055562 ==
* Changed 1 qualifiers
== Q3725754 ==
* Changed 1 qualifiers
== Q3960965 ==
* Changed 1 qualifiers
== Q3956105 ==
* Changed 2 qualifiers
== Q3770170 ==
* Changed 1 qualifiers
== Q3946002 ==
* Changed 1 qualifiers
== Q3856434 ==
* Changed 1 qualifiers
== Q605520 ==
* Changed 1 qualifiers
== Q3992846 ==
* Changed 1 qualifiers
== Q458064 ==
* Changed 3 qualifiers
== Q3605650 ==
* Changed 1 qualifiers
== Q3615971 ==
* Changed 2 qualifiers
== Q9263502 ==
* Changed 1 qualifiers
== Q535345 ==
* Changed 1 qualifiers
== Q3723227 ==
* Changed 1 qualifiers
== Q1055420 ==
* Changed 1 qualifiers
== Q923794 ==
* Changed 1 qualifiers
== Q3745860 ==
* Changed 2 qualifiers
== Q2754925 ==
* Changed 1 qualifiers
== Q1054010 ==
* Changed 1 qualifiers
== Q728328 ==
* Changed 1 qualifiers
== Q3616923 ==
* Changed 2 qualifiers
Sleeping for 5.0 seconds, 2019-02-23 20:45:00
== Q1970696 ==
* Changed 1 qualifiers
== Q3618332 ==
* Changed 1 qualifiers
== Q3767545 ==
* Changed 1 qualifiers
== Q3619950 ==
* Changed 1 qualifiers
== Q440710 ==
* Changed 2 qualifiers
== Q369718 ==
* Changed 1 qualifiers
== Q3767005 ==
* Changed 1 qualifiers
== Q336259 ==
* Changed 1 qualifiers
== Q3054632 ==
* Changed 3 qualifiers
== Q3615535 ==
* Changed 1 qualifiers
== Q4013292 ==
* Changed 1 qualifiers
== Q817307 ==
* Changed 1 qualifiers
== Q1238904 ==
* Changed 1 qualifiers
== Q3852894 ==
* Changed 1 qualifiers
== Q3619716 ==
* Changed 2 qualifiers
== Q371149 ==
* Changed 3 qualifiers
== Q24807484 ==
* Changed 2 qualifiers
== Q3956050 ==
* Changed 2 qualifiers
== Q3616115 ==
* Nothing to do
== Q2528704 ==
* Nothing to do
== Q517161 ==
* Nothing to do
== Q3750098 ==
* Nothing to do
== Q1132305 ==
* Nothing to do
== Q3749833 ==
* Nothing to do
== Q3609104 ==
* Nothing to do
== Q1236400 ==
* Nothing to do
== Q547449 ==
* Nothing to do
== Q3610018 ==
* Nothing to do
== Q3724464 ==
* Nothing to do
== Q3766017 ==
* Nothing to do
== Q488754 ==
* Nothing to do
== Q1334761 ==
* Nothing to do
== Q3659847 ==
* Nothing to do
== Q3760943 ==
* Nothing to do
== Q367511 ==
* Nothing to do
== Q684295 ==
* Nothing to do
== Q17420721 ==
* Nothing to do
== Q559577 ==
* Nothing to do
== Q1111570 ==
* Nothing to do
== Q3712959 ==
* Nothing to do
== Q47547 ==
* Nothing to do
== Q3721452 ==
* Nothing to do
== Q3767788 ==
* Nothing to do
== Q3769950 ==
* Nothing to do
== Q558810 ==
* Nothing to do
== Q3847412 ==
* Nothing to do
== Q3497963 ==
* Nothing to do
== Q2252913 ==
* Nothing to do
== Q3939177 ==
* Nothing to do
== Q3615827 ==
* Nothing to do
== Q3619876 ==
* Nothing to do
== Q3851209 ==
* Nothing to do
== Q3749867 ==
* Nothing to do
== Q3751362 ==
* Nothing to do
== Q583545 ==
* Nothing to do
== Q3619680 ==
* Nothing to do
== Q4013576 ==
* Nothing to do
== Q3846514 ==
* Nothing to do
== Q3839410 ==
* Nothing to do
== Q3721795 ==
* Nothing to do
== Q436123 ==
* Nothing to do
== Q3838897 ==
* Nothing to do
== Q3860840 ==
* Nothing to do
== Q744324 ==
* Nothing to do
== Q558815 ==
* Nothing to do
== Q3779986 ==
* Nothing to do
== Q1042010 ==
* Nothing to do
== Q434786 ==
* Nothing to do
== Q552229 ==
* Nothing to do
== Q3768181 ==
* Nothing to do
== Q493714 ==
* Nothing to do
== Q948169 ==
* Nothing to do
== Q1072333 ==
* Nothing to do
== Q15930092 ==
* Nothing to do
== Q3893103 ==
* Nothing to do
== Q3619895 ==
* Nothing to do
== Q1130103 ==
* Nothing to do
== Q453848 ==
* Nothing to do
== Q3767808 ==
* Nothing to do
== Q3798977 ==
* Nothing to do
== Q2249674 ==
* Nothing to do
== Q17420806 ==
* Nothing to do
== Q3615576 ==
* Nothing to do
== Q3934473 ==
* Nothing to do
== Q719360 ==
* Nothing to do
== Q3417325 ==
* Nothing to do
== Q3769694 ==
* Nothing to do
== Q3771634 ==
* Nothing to do
== Q3886985 ==
* Nothing to do
== Q3362598 ==
* Nothing to do
== Q3840240 ==
* Nothing to do
== Q3779392 ==
* Nothing to do
== Q3762885 ==
* Nothing to do
== Q3847960 ==
* Nothing to do
== Q3960891 ==
* Nothing to do
== Q3846928 ==
* Nothing to do
== Q671532 ==
* Nothing to do
== Q3935910 ==
* Nothing to do
== Q3905291 ==
* Nothing to do
== Q3613872 ==
* Nothing to do
== Q3750455 ==
* Nothing to do
== Q3847552 ==
* Nothing to do
== Q3932712 ==
* Nothing to do
== Q550363 ==
* Nothing to do
== Q445685 ==
* Nothing to do
== Q3749360 ==
* Nothing to do
== Q340239 ==
* Nothing to do
== Q737794 ==
* Nothing to do
== Q3659902 ==
* Nothing to do
== Q3765330 ==
* Nothing to do
== Q3779498 ==
* Nothing to do
== Q3769638 ==
* Nothing to do
== Q1083986 ==
* Nothing to do
== Q3619732 ==
* Nothing to do
== Q3658941 ==
* Nothing to do
== Q3751233 ==
* Nothing to do
== Q3764747 ==
* Nothing to do
== Q312058 ==
* Nothing to do
== Q2847139 ==
* Nothing to do
== Q3771063 ==
* Nothing to do
== Q601298 ==
* Nothing to do
== Q3839249 ==
* Nothing to do
== Q3750881 ==
* Nothing to do
== Q3762149 ==
* Nothing to do
== Q3611393 ==
* Nothing to do
== Q3909566 ==
* Nothing to do
== Q1122937 ==
* Nothing to do
== Q1696496 ==
* Nothing to do
== Q3760928 ==
* Nothing to do
== Q3875891 ==
* Nothing to do
== Q556191 ==
* Nothing to do
== Q3840256 ==
* Nothing to do
== Q4013395 ==
* Nothing to do
== Q3886220 ==
* Nothing to do
== Q11698554 ==
* Nothing to do
== Q1060314 ==
* Nothing to do
== Q9268406 ==
* Nothing to do
== Q693317 ==
* Nothing to do
== Q3721200 ==
* Nothing to do
== Q3838724 ==
* Nothing to do
== Q3849036 ==
* Nothing to do
== Q3848979 ==
* Nothing to do
== Q3702554 ==
* Nothing to do
== Q1055212 ==
* Nothing to do
== Q780885 ==
* Nothing to do
== Q319547 ==
* Nothing to do
== Q551188 ==
* Nothing to do
== Q663538 ==
* Nothing to do
== Q1055220 ==
* Nothing to do
== Q3726658 ==
* Nothing to do
== Q3835605 ==
* Nothing to do
== Q3769568 ==
* Nothing to do
== Q3611490 ==
* Nothing to do
== Q695075 ==
* Nothing to do
== Q3619518 ==
* Nothing to do
== Q3844718 ==
* Nothing to do
== Q3609180 ==
* Nothing to do
== Q3992004 ==
* Nothing to do
== Q466836 ==
* Nothing to do
== Q3742139 ==
* Nothing to do
== Q1553555 ==
* Nothing to do
== Q3874743 ==
* Nothing to do
== Q1055262 ==
* Nothing to do
== Q276023 ==
* Nothing to do
== Q3852744 ==
* Nothing to do
== Q159648 ==
* Nothing to do
== Q3733864 ==
* Nothing to do
== Q722610 ==
* Nothing to do
== Q3938722 ==
* Nothing to do
== Q1053244 ==
* Nothing to do
== Q2094471 ==
* Nothing to do
== Q3767884 ==
* Nothing to do
== Q3756943 ==
* Nothing to do
== Q441086 ==
* Nothing to do
== Q3771422 ==
* Nothing to do
== Q433628 ==
* Nothing to do
== Q1098092 ==
* Nothing to do
== Q234771 ==
* Nothing to do
== Q3619122 ==
* Nothing to do
== Q3893565 ==
* Nothing to do
== Q3617117 ==
* Nothing to do
== Q1394911 ==
* Nothing to do
== Q11714113 ==
* Nothing to do
== Q1220 ==
* Nothing to do
== Q3845641 ==
* Nothing to do
== Q12973043 ==
* Nothing to do
== Q3743804 ==
* Nothing to do
== Q3609131 ==
* Nothing to do
== Q3611195 ==
* Nothing to do
== Q3768548 ==
* Nothing to do
== Q3751164 ==
* Nothing to do
== Q192818 ==
* Nothing to do
== Q1077655 ==
* Nothing to do
== Q3702196 ==
* Nothing to do
== Q317142 ==
* Nothing to do
== Q3746504 ==
* Nothing to do
== Q3608321 ==
* Nothing to do
== Q776886 ==
* Nothing to do
== Q3840472 ==
* Nothing to do
== Q949306 ==
* Nothing to do
== Q3848931 ==
* Nothing to do
== Q3751333 ==
* Nothing to do
== Q3838684 ==
* Nothing to do
== Q3903996 ==
* Nothing to do
== Q3848527 ==
* Nothing to do
== Q4007856 ==
* Nothing to do
== Q1346627 ==
* Nothing to do
== Q701570 ==
* Nothing to do
== Q3611466 ==
* Nothing to do
== Q2002390 ==
* Nothing to do
== Q3763030 ==
* Nothing to do
== Q3881851 ==
* Nothing to do
== Q3713129 ==
* Nothing to do
== Q11686500 ==
* Nothing to do
== Q3847447 ==
* Nothing to do
== Q4014523 ==
* Nothing to do
== Q3847266 ==
* Nothing to do
== Q3766909 ==
* Nothing to do
== Q68050 ==
* Nothing to do
== Q1690028 ==
* Nothing to do
== Q3768259 ==
* Nothing to do
== Q17420892 ==
* Nothing to do
== Q1055587 ==
* Nothing to do
== Q617639 ==
* Nothing to do
== Q1426951 ==
* Nothing to do
== Q3766525 ==
* Nothing to do
== Q316288 ==
* Nothing to do
== Q5444 ==
* Nothing to do
== Q446679 ==
* Nothing to do
== Q4308879 ==
* Nothing to do
== Q3751239 ==
* Nothing to do
== Q4003346 ==
* Nothing to do
== Q3658942 ==
* Nothing to do
== Q939831 ==
* Nothing to do
== Q3659874 ==
* Nothing to do
== Q3749420 ==
* Nothing to do
== Q386491 ==
* Nothing to do
== Q327879 ==
* Nothing to do
== Q3765105 ==
* Nothing to do
== Q380297 ==
* Nothing to do
== Q1077663 ==
* Nothing to do
== Q3645753 ==
* Nothing to do
== Q2307679 ==
* Nothing to do
== Q3617684 ==
* Nothing to do
== Q3762932 ==
* Nothing to do
== Q286469 ==
* Nothing to do
== Q3846003 ==
* Nothing to do
== Q17420692 ==
* Nothing to do
== Q446794 ==
* Nothing to do
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/srv/paws/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    376             try:  # Python 2.7, use buffering of HTTP responses
--> 377                 httplib_response = conn.getresponse(buffering=True)
    378             except TypeError:  # Python 2.6 and older, Python 3

TypeError: getresponse() got an unexpected keyword argument 'buffering'

During handling of the above exception, another exception occurred:

KeyboardInterrupt                         Traceback (most recent call last)
<ipython-input-18-21489c794119> in <module>()
     23 
     24     Qitem = pywikibot.ItemPage(repo, item)
---> 25     Qitem.get()
     26 
     27     QitemJSON = Qitem.toJSON()

/srv/paws/pwb/pywikibot/page.py in get(self, force, get_redirect, *args, **kwargs)
   4454         @raise NotImplementedError: a value in args or kwargs
   4455         """
-> 4456         data = super(ItemPage, self).get(force, *args, **kwargs)
   4457 
   4458         if self.isRedirectPage() and not get_redirect:

/srv/paws/pwb/pywikibot/page.py in get(self, force, *args, **kwargs)
   3897 
   3898             try:
-> 3899                 data = self.repo.loadcontent(identification)
   3900             except APIError as err:
   3901                 if err.code == 'no-such-entity':

/srv/paws/pwb/pywikibot/site.py in loadcontent(self, identification, *props)
   7603                                     props=props if props else False)
   7604         req = self._simple_request(**params)
-> 7605         data = req.submit()
   7606         if 'success' not in data:
   7607             raise api.APIError(data['errors'])

/srv/paws/pwb/pywikibot/data/api.py in submit(self)
   1985                                                                    paramstring)
   1986             rawdata, use_get = self._http_request(use_get, uri, body, headers,
-> 1987                                                   paramstring)
   1988             if rawdata is None:
   1989                 continue

/srv/paws/pwb/pywikibot/data/api.py in _http_request(self, use_get, uri, body, headers, paramstring)
   1744                 site=self.site, uri=uri,
   1745                 method='GET' if use_get else 'POST',
-> 1746                 body=body, headers=headers)
   1747         except Server504Error:
   1748             pywikibot.log('Caught HTTP 504 error; retrying')

/srv/paws/pwb/pywikibot/tools/__init__.py in wrapper(*__args, **__kw)
   1735                              cls, depth)
   1736                     del __kw[old_arg]
-> 1737             return obj(*__args, **__kw)
   1738 
   1739         if not __debug__:

/srv/paws/pwb/pywikibot/comms/http.py in request(site, uri, method, params, body, headers, data, **kwargs)
    322 
    323     baseuri = site.base_url(uri)
--> 324     r = fetch(baseuri, method, params, body, headers, **kwargs)
    325     site.throttle.retry_after = int(r.response_headers.get('retry-after', 0))
    326     return r.text

/srv/paws/pwb/pywikibot/comms/http.py in fetch(uri, method, params, body, headers, default_error_handling, use_fake_user_agent, data, **kwargs)
    519             headers['user-agent'] = fake_user_agent()
    520 
--> 521     request = _enqueue(uri, method, params, body, headers, **kwargs)
    522     # if there's no data in the answer we're in trouble
    523     assert request._data is not None

/srv/paws/pwb/pywikibot/comms/http.py in _enqueue(uri, method, params, body, headers, data, **kwargs)
    475     request = threadedhttp.HttpRequest(
    476         uri, method, params, body, all_headers, callbacks, **kwargs)
--> 477     _http_process(session, request)
    478     return request
    479 

/srv/paws/pwb/pywikibot/comms/http.py in _http_process(session, http_request)
    389                                    headers=headers, auth=auth, timeout=timeout,
    390                                    verify=not ignore_validation,
--> 391                                    **http_request.kwargs)
    392     except Exception as e:
    393         http_request.data = e

/srv/paws/lib/python3.6/site-packages/requests/sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
    510         }
    511         send_kwargs.update(settings)
--> 512         resp = self.send(prep, **send_kwargs)
    513 
    514         return resp

/srv/paws/lib/python3.6/site-packages/requests/sessions.py in send(self, request, **kwargs)
    620 
    621         # Send the request
--> 622         r = adapter.send(request, **kwargs)
    623 
    624         # Total elapsed time of the request (approximately)

/srv/paws/lib/python3.6/site-packages/requests/adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
    443                     decode_content=False,
    444                     retries=self.max_retries,
--> 445                     timeout=timeout
    446                 )
    447 

/srv/paws/lib/python3.6/site-packages/urllib3/connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, **response_kw)
    598                                                   timeout=timeout_obj,
    599                                                   body=body, headers=headers,
--> 600                                                   chunked=chunked)
    601 
    602             # If we're going to release the connection in ``finally:``, then

/srv/paws/lib/python3.6/site-packages/urllib3/connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    378             except TypeError:  # Python 2.6 and older, Python 3
    379                 try:
--> 380                     httplib_response = conn.getresponse()
    381                 except Exception as e:
    382                     # Remove the TypeError from the exception chain in Python 3;

/usr/lib/python3.6/http/client.py in getresponse(self)
   1329         try:
   1330             try:
-> 1331                 response.begin()
   1332             except ConnectionError:
   1333                 self.close()

/usr/lib/python3.6/http/client.py in begin(self)
    295         # read until we get a non-100 response
    296         while True:
--> 297             version, status, reason = self._read_status()
    298             if status != CONTINUE:
    299                 break

/usr/lib/python3.6/http/client.py in _read_status(self)
    256 
    257     def _read_status(self):
--> 258         line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
    259         if len(line) > _MAXLINE:
    260             raise LineTooLong("status line")

/usr/lib/python3.6/socket.py in readinto(self, b)
    584         while True:
    585             try:
--> 586                 return self._sock.recv_into(b)
    587             except timeout:
    588                 self._timeout_occurred = True

/usr/lib/python3.6/ssl.py in recv_into(self, buffer, nbytes, flags)
   1007                   "non-zero flags not allowed in calls to recv_into() on %s" %
   1008                   self.__class__)
-> 1009             return self.read(nbytes, buffer)
   1010         else:
   1011             return socket.recv_into(self, buffer, nbytes, flags)

/usr/lib/python3.6/ssl.py in read(self, len, buffer)
    869             raise ValueError("Read on closed or unwrapped SSL socket.")
    870         try:
--> 871             return self._sslobj.read(len, buffer)
    872         except SSLError as x:
    873             if x.args[0] == SSL_ERROR_EOF and self.suppress_ragged_eofs:

/usr/lib/python3.6/ssl.py in read(self, len, buffer)
    629         """
    630         if buffer is not None:
--> 631             v = self._sslobj.read(len, buffer)
    632         else:
    633             v = self._sslobj.read(len)

KeyboardInterrupt: